Dynamic one-step / two-step timestamping per packet in network device

By dynamically selecting one-step or two-step timestamping methods in network devices, the problems of high hardware costs and clock synchronization delay in the prior art are solved, and the accuracy of clock synchronization and the simplicity of implementation are improved.

CN119072869APending Publication Date: 2024-12-03MARVELL ISRAEL (M L S L) LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202380035074.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-10-28
Filing Date
2023-02-24
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

In the existing clock synchronization protocol, step-time stamping technology increases the hardware requirements, cost and power consumption of network equipment, while two-step timestamping technology leads to increased clock synchronization delay and implementation complexity, and may lead to synchronization errors.

Method used

In a network device, the processor receives the timing message and the corresponding control header, and dynamically selects to execute a one-step or two-step timestamp method, and determines whether to embed the timing information in the packet or store it in memory based on the information in the control header, so as to Transfer in subsequent packets.

Benefits of technology

It reduces the hardware requirements and costs of network equipment, improves the end-to-end accuracy of clock synchronization, simplifies implementation complexity, and reduces the occurrence of synchronization errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119072869A_ABST
    Figure CN119072869A_ABST
Patent Text Reader

Abstract

A processor of a network device receives i) a timing message and ii) a control header corresponding to the timing message. The control header includes information indicating a timestamped method for transmitting timing information corresponding to transmission of the timing message by the network device. The timestamping method is selected from a set of a plurality of timestamping methods, the set of the plurality of timestamping methods including: i) a one-step timestamping method and ii) a two-step timestamping method. The processor determines whether to perform a two-step timing timestamping method based on analyzing information in the control header. The network device transmits a timing message within the first packet and determines timing information corresponding to the transmission of the first packet. In response to determining that the timestamping method is a two-step method, the processor stores timing information in the memory for subsequent inclusion in a second packet to be subsequently transmitted.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application is a partial continuation of U.S. patent application No. 17 / 976,658, filed on October 28, 2022, entitled “Dynamic one-step / two-step Timestamping per Packet in network devices”, which claims the benefit of U.S. Provisional Patent Application No. 63 / 313,293, filed on February 24, 2022, entitled “Dynamic 1 / 2step timestamping in MCH Based PHY”, and claims the benefit of U.S. Provisional Patent Application No. 63 / 313,756, filed on February 25, 2022, entitled “Encrypted PTP Frames 1step timestamping over USXGMII / USGMIIInterfaces”. Additionally, this application claims the benefit of the following provisional applications: U.S. Provisional Patent Application No. 63 / 313,293, filed on February 24, 2022; U.S. Provisional Patent Application No. 63 / 313,758, filed on February 25, 2022, entitled “Timestamp Queues (TSQ) in Medium Access Control (MAC)”; and U.S. Provisional Patent Application No. 63 / 313,756, filed on February 25, 2022, entitled “Encrypted PTP Frames 1 Step Timestamping over USXGMII / USGMII Interfaces”. The disclosures of all of the above-referenced applications are expressly incorporated herein by reference in their entirety. Technical Field

[0003] The present disclosure relates generally to communication networks, and more particularly to time stamping packets in network devices. Background Art

[0004] Clock synchronization protocols, such as the Precision Time Protocol (PTP), are commonly used in packet-based networks to synchronize clocks maintained at different network devices across a computer network. In such clock synchronization protocols, a first network device maintaining a master clock transmits a timing packet to a second network device maintaining a slave clock. The first network device also transmits a transmission timestamp to the second network device indicating when the first network device transmitted the timing packet. The second network device uses the transmission timestamp corresponding to the timing packet and the estimated network delay to adjust the slave clock so that the slave clock is synchronized with the master clock.

[0005] In a technique generally referred to as "one-step timestamping," a first network device includes a transmission timestamp in the timing packet itself. Some one-step timestamping implementations involve hardware that is capable of embedding a transmission timestamp in a timing packet just before the first network device transmits the timing packet, such that the value of the transmission timestamp in the timing packet is very close to the actual time when the timing packet was transmitted. Some one-step timestamping implementations increase hardware requirements, cost, and / or power consumption in the network device because the network device typically needs to perform parsing and timing calculation operations on the packets at line speed in order to embed the timestamp or other timing information in the timing packet in real time as the timing packet is transmitted from the network device.

[0006] In a technique commonly referred to as "two-step timestamping," a first network device generates a transmission timestamp in conjunction with a transmission timing packet, stores the transmission timestamp in a register, but does not include the transmission timestamp in the timing packet itself. Instead, the first network device includes a transmission timestamp corresponding to the transmission time of the timing packet in a subsequent packet. Because the transmission timestamp is transmitted in the subsequent packet, the two-step timestamping system does not require "on-the-fly" hardware to embed the transmission timestamp into the timing packet itself. However, because the second communication device cannot determine the transmission time of the timing packet until the subsequent packet is received, the delay associated with the timing packet is increased, which may reduce the end-to-end accuracy of the clock in the network. Moreover, two-step timestamping requires that the subsequent packet be matched with the corresponding timing packet at the second network device, which increases implementation complexity and sometimes leads to synchronization errors when the match is not performed correctly. In addition, two-step timestamping requires the transmission of additional packets, which increases overhead. Summary of the invention

[0007] In an embodiment, a network device configured to operate in a communication network includes: a memory; and a processor, including or coupled to the memory. The processor is configured to: receive i) a timing message and ii) a control header corresponding to the timing message, the control header including information indicating a timestamping method for transmitting timing information corresponding to transmission of the timing message by the network device, the timestamping method being selected from a set of multiple timestamping methods, the network device being configured to perform the set of multiple timestamping methods, the multiple timestamping method sets including: i) a one-step timestamping method, ii) a two-step timestamping method; determine whether to perform the two-step timestamping method based on analyzing the information in the control header indicating the timestamping method; transmit the timing message in a first packet from the network device; determine the timing information corresponding to the transmission of the first packet by the network device; and in response to the processor determining that the timestamping method is the two-step method, store the timing information in the memory for subsequent inclusion in a second packet, the second packet to be transmitted by the network device after the transmission of the first packet.

[0008] In another embodiment, a method for processing a timing packet in a network device includes: receiving, at a processor of the network device, i) a timing message and ii) a control header corresponding to the timing message, the control header including information indicating a timestamping method for conveying timing information corresponding to the timing message transmitted by the network device, the timestamping method being selected from a set of multiple timestamping methods, the network device being configured to execute the set of multiple timestamping methods, the set of multiple timestamping methods including: i) a one-step timestamping method, ii) a two-step timestamping method; determining, at the processor, whether to execute the two-step timestamping method based on analyzing the information in the control header indicating the timestamping method; transmitting, by the network device, a timing message within a first packet; determining, at the processor, the timing information corresponding to the first packet transmitted by the network device; and in response to the processor determining that the timestamping method is a two-step method, storing, by the processor, the timing information in a memory for subsequent inclusion in a second packet, the second packet to be transmitted by the network device after the first packet is transmitted, the memory being included in the processor or coupled to the processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 is a simplified block diagram of an example network device configured to dynamically perform one-step timestamping or two-step timestamping on a per-packet basis, according to an embodiment.

[0010] Figure 2 According to the embodiment, Figure 1 Schematic diagram of example timing messages processed by a network device.

[0011] FIG. 3A to FIG. 3C According to various embodiments, Figure 1An illustration of an example control header of a timing message processed by a network device.

[0012] Figure 4 is a flow chart of an example method for processing packets in a network device according to an embodiment.

[0013] Figure 5 is a block diagram of another example network device configured to transmit time-stamped packets in a network according to another embodiment.

[0014] Figure 6 is a block diagram of another example network device configured to transmit time-stamped packets in a network according to another embodiment.

[0015] Figure 7 is a flow chart of another example method for processing timing packets in a network device according to another embodiment. DETAILED DESCRIPTION

[0016] The IEEE 802.1AS standard is a profile of the Precision Time Protocol (PTP) used with Audio Video Bridging (AVB) and Time Sensitive Networking (TSN). The IEEE 802.1AS standard requires that some timing packets (e.g., Peer Delay Messages) will use 2-step timestamping, while other timing packets (e.g., Sync Messages) may use either 1-step timestamping or 2-step timestamping.

[0017] In the embodiments described below, the network device selectively performs 1-step timestamping or 2-step timestamping on a per-packet basis. In some such embodiments, the network device performs 2-step timestamping on timing packets for which a protocol (e.g., a protocol defined by the IEEE 802.1AS standard or another suitable protocol) requires the use of 2-step timestamping, and performs 1-step timestamping on timing packets for which the protocol allows or requires the use of 1-step timestamping. In some embodiments described below, a lower-level processor of the network device is configured to perform 1-step timestamping and 2-step timestamping, and a higher-level processor is configured to, for each of at least some of the packets for which a transmission timestamp is to be generated, instruct the lower-level processor to selectively perform 1-step timestamping or 2-step timestamping on a particular packet. In some embodiments, the higher-level processor generates a control header associated with the timing packet, the control header having an indication of whether 1-step timestamping or 2-step timestamping is to be performed on the timing packet, and the higher-level processor provides the control header to the lower-level processor in conjunction with the timing packet. The lower level processor analyzes the control header and selectively performs 1-step timestamping or 2-step timestamping on the timing packets according to the indication in the control header whether to perform 1-step timestamping or 2-step timestamping on the timing packets.

[0018] Figure 11 is a block diagram of an example network device 100 according to an embodiment, the example network device 100 being configured to transmit packets with timestamps in a network to allow one or more other devices to synchronize with a master clock in the network. The network device 100 is configured to operate according to a synchronization protocol for timing synchronization. In one embodiment, the network device 100 is configured to operate according to the Institute of Electrical and Electronics Engineers (IEEE) 802.1AS standard. In another embodiment, the network device 100 is configured to operate according to another synchronization protocol, such as the IEEE 1588 standard, commonly referred to as the "Precision Time Protocol" or "PTP", the Network Time Protocol (NTP), or another suitable synchronization protocol.

[0019] In various embodiments in which the network device 100 operates according to the IEEE802.1AS standard, the network device 100 is configured to operate as an endpoint device that implements a master clock or a slave clock on the network, or as a relay device that relays a master clock to one or more endpoint devices on the network. Typically, in various embodiments, the network device 100 is configured to generate timing packets and / or update timing information in received timing packets, and transmit timing packets to one or more other devices on the network to allow one or more other devices to synchronize with the master clock on the network. As used herein, the term "timing packet" refers to a network data packet that includes a timing message generated and transmitted by a network device in the network, which timing message is used to perform time-related processes in the network, such as clock synchronization between network devices in the network.

[0020] The network device 100 includes one or more network ports 104 configured to be coupled to corresponding one or more network links 106 for coupling the network device 100 to one or more other devices in the network. In one embodiment, the network device 100 also includes one or more physical layer (PHY) processors 108 coupled to the one or more network ports 104. Figure 1 104, but in some embodiments, the network device 100 includes a PHY processor 108 coupled to multiple (e.g., all) network ports 104. In another embodiment, the network device 100 is a single port device that includes only a single PHY processor 108 coupled to a single port 104. For brevity, one or more PHY processors 108 are sometimes referred to herein as "PHY processor 108."

[0021] In various embodiments, the PHY processor 108 includes any suitable combination of one or two or more of a digital-to-analog converter (DAC), an amplifier, a modulator, etc. (not shown) to convert a digital signal corresponding to a packet into an analog signal suitable for transmission via the communication link 106. The PHY processor 108 also includes timing-related circuitry to implement timing synchronization operations. For example, in one embodiment, the PHY processor 108-1 includes an egress timestamping engine 110, and the PHY processor 108-2 includes an ingress timestamping engine 112. In one embodiment, the egress timestamping engine 110 of the PHY processor 108-1 is configured to, i) generate timing information based on a clock maintained by the PHY clock 113, the timing information corresponding to the transmission time of the timing packet from the network device 100, and ii) selectively a) embed the timing information into the timing packet itself, or ii) store the timing information in the memory 115 on a per-packet basis. In one embodiment, embedding the timing information in the timing packet itself corresponds to one-step timestamping, and storing the timing information in the memory 115 corresponds to two-step timestamping.

[0022] In one embodiment, the ingress timestamping engine 112 of the PHY processor 108-2 is configured to generate a timestamp for the received timing packet based on a clock maintained by the PHY clock 113, the timestamp corresponding to the time of receipt of the timing packet by the network device 100. In another embodiment, the PHY processor 108-1 and the PHY processor 108-2 are independent entities that maintain corresponding PHY clocks 113. In some such embodiments, an appropriate clock synchronization mechanism is employed to synchronize the corresponding PHY clocks 113. In embodiments where the PHY processor 108-1 and the PHY processor 108-2 maintain corresponding PHY clocks 113, the network device 100 includes a common oscillator (not shown) for driving the corresponding PHY clocks 113.

[0023] In one embodiment, the egress timestamping engine 110 and the ingress timestamping engine 112 are implemented in hardware that is configured to perform on-the-fly operations at line rate. For example, in one embodiment, the egress timestamping engine 110 of the PHY processor 108-1 is configured to generate timing information corresponding to the transmission time of the packet on-the-fly while the packet is being transmitted by the network device 100, and when one-step timestamping is to be performed, embed the timing information in the packet as it is transmitted from the network device 100. In one embodiment, the ingress timestamping engine 112 is configured to generate timestamps for the packet on-the-fly as the packet is received by the network device 100. Although in one embodiment, the PHY processor 108-1 is configured to generate timestamps for the packet on-the-fly as it is received by the network device 100, Figure 1 is shown as including an egress timestamping engine, and the PHY processor 108-2 ... Figure 1 100 is shown as including an ingress timestamping engine, but the PHY processor 108 includes both an egress timestamping engine and an ingress timestamping engine, the egress timestamping engine being configured to generate timing information for packets transmitted from the network device 100, and the ingress timestamping engine being configured to generate timestamps for packets received by the network device 100.

[0024] In one embodiment, the network device 100 also includes a media access control (MAC) processor 118 and a host processor 120. In one embodiment, the MAC processor 118 is implemented using one or more integrated circuits (e.g., one or more application specific integrated circuits (ASICs)). In one embodiment, the host processor 120 is or is implemented by a processing unit such as a central processing unit (CPU) of the network device 100. In one embodiment, the host processor 120 is configured to implement computer-readable instructions stored in a memory (not shown) of the network device 100. The MAC processor 118 is coupled to the one or more PHY processors 108 and the host processor 120. In one embodiment, the MAC processor is configured to receive packets from the one or more PHY processors 108, perform MAC operations on packets received from the one or more PHY processors 108, such as parsing and decapsulating packets, and transmit packets to the host processor 120 for further processing. In one embodiment, the MAC processor 118 is further configured to receive messages from the host processor 120, perform MAC operations on the messages received from the host processor 120, such as encapsulating the messages with one or more protocol headers to generate packets, and transmit the packets to the appropriate one or more PHY processors 108 for transmission from the network device 100. As will be discussed in more detail below, in some embodiments, the MAC processor 118 is configured to perform initial processing of timing packets and provide a control header to a PHY processor (e.g., PHY processor 108-2) that contains information indicating whether the PHY processor 108 uses one-step timestamping or two-step timestamping with the corresponding timing packets.

[0025] In embodiments and / or scenarios where the network device 100 operates as an endpoint device, the main processor 120 is configured to generate timing messages originating from the network device 100. In one embodiment, the network device 100 includes or implements a timing controller 126, which is configured to generate timing messages for transmission from the network device 100. In an embodiment, the timing controller 126 is configured to generate PTP messages, such as, in some embodiments, PTP synchronization (Sync) messages, PTP delay request (Pdelay-Req) messages, PTP peer delay response (Pdelay-Resp) messages, etc. In other embodiments, the timing controller 126 is configured to generate other suitable types of timing messages.

[0026] In some embodiments, the timing controller 126 is configured to determine, in conjunction with the timing messages generated by the timing controller 126, whether to use one-step timestamping or two-step timestamping for each of at least some of the timing messages. For example, according to one embodiment, the network device 100 is configured to use one-step timestamping with a first set of one or more types of timing messages and to use two-step timestamping with a second set of one or more types of timing messages. As an illustrative example only, the first set of one or more types of timing messages includes PTP synchronization messages, and the second set of one or more types of timing messages includes Pdelay-Resp messages. Therefore, in some embodiments, the timing controller 126 is configured to determine, in conjunction with the timing packets generated by the timing controller 126, whether to use one-step timestamping or two-step timestamping for the timing packets based on the message type of the timing messages. For example, according to one embodiment, the timing controller 126 is configured to determine to use one-step timestamping if the message type of the timing message is in the first set of one or more types of timing messages; and to use two-step timestamping if the message type of the timing message is in the second set of one or more types of timing messages. In other embodiments, the timing controller 126 is configured to determine whether to use one-step timestamping or two-step timestamping for a timing message additionally or alternatively based on one or more other suitable criteria in conjunction with the timing message generated by the timing controller 126 .

[0027] In one embodiment, when a timing message is to be transmitted using one-step timestamping, the timing controller 126 is configured to generate the timing message to include initial timing information indicating the transmission time of the timing packet. In one embodiment, the initial timing information is determined based on the master clock 128 maintained by the master processor 120. In one embodiment, the timing controller 126 is configured to set the timestamp field in the timing message generated by the timing controller 126 to the current value of the master clock 128 maintained by the master processor 120. The timing controller 126 is also configured to set the correction field in the timing message to the initial correction value for compensating the current value of the master clock 128 for the transmission delay that the timing packet is expected to experience between the current time and the time when the timing packet is actually transmitted from the network device 100. In one embodiment, the timing controller 126 includes a timestamping engine 132 configured to set the timestamp field in the timing packet to the current value of the master clock 128. In one embodiment, the timestamping engine 132 is also configured to set the correction field in the timing packet to the initial correction value.

[0028] Brief reference Figure 2 In one embodiment, the example timing message 200 corresponds to a timing message generated by the timing controller 126. The timing message 200 includes a header 202 and a data portion 204. In one embodiment, the header 202 includes a correction field 206. In some embodiments, the header field 202 includes one or more other fields in addition to the correction field 206. The data portion 204 includes a timestamp field 208. In some embodiments, the data portion 204 includes one or more fields in addition to the timestamp field 208.

[0029] Reference now Figure 1 and Figure 2 In one embodiment, the timestamping engine 132 is configured to set the timestamp field 208 to the current value of the master clock 128. In one embodiment, the timestamping engine 132 is also configured to set the correction field 206 to the initial correction value.

[0030] In one embodiment, the master clock 128 used by the host processor 120 to generate initial timing information for the timing packets is less accurate than the PHY clock 113. For example, in one embodiment, the master clock 128 maintains the time of day with an accuracy of one millisecond or a few milliseconds, while the PHY clock 113 maintains the time of day with an accuracy of one nanosecond or a few nanoseconds. As will be explained in more detail below, when one-step timestamping is implemented, the egress timestamping engine 110 subsequently updates the correction fields (e.g., correction field 206) of the timing packets based on the PHY clock 113 as the timing packets are transmitted from the network device 100. In at least some embodiments, the correction fields are updated by the PHY processor 108 based on the PHY clock 113 to compensate for the inaccuracy of the master clock 128.

[0031] In one embodiment, when one-step timestamping is to be used, the timing controller 126 generates a correction field value that is equal to the negative value of the nanosecond portion of the timestamp in the timestamp field 208, so that the PHY processor 108 can subsequently update the nanosecond portion of the timestamp based on the PHY clock 113 when the timing packet 152 is transmitted from the network device 100. In one embodiment, the timing controller 126 also adds the egress pipeline delay to the correction field value, where the egress pipeline delay is a preconfigured value of a static delay from the point at which the PHY processor 108 timestamped the timing packet to the egress pin of the PHY processor 108 via which the timing packet is sent out from the PHY processor 108.

[0032] In some embodiments, the timing controller 126 encapsulates the timing message in a User Datagram Protocol (UDP) datagram. In some embodiments where the timing message is encapsulated in a UDP datagram having a checksum field, the timing controller 126 adjusts the checksum field based on the values ​​of the timestamp field 208 and the correction field 206 to maintain the correctness of the checksum field of the UDP datagram.

[0033] The host processor 120 is configured to transmit the timing message to the MAC processor 118. In some embodiments, transmitting the timing message to the MAC processor 118 includes transmitting to the MAC processor 118 a UDP datagram encapsulating the timing message.

[0034] According to an embodiment, in conjunction with transmitting the timing message to the MAC processor 118, the timing controller 126 is configured to indicate to the MAC processor 118 whether one-step timestamping or two-step timestamping is used for the timing message. In other embodiments, the timing controller 126 does not indicate to the MAC processor 118 whether one-step timestamping or two-step timestamping is used for the timing message. For example, in some embodiments, the MAC processor 118 determines whether one-step timestamping or two-step timestamping is used for the timing message without relying on an indication from the host processor 120. For example, according to one embodiment, the MAC processor 118 determines the type of timing message received from the host processor 120 and determines whether one-step timestamping or two-step timestamping is used for the timing message based on the determined type of the timing message.

[0035] According to an embodiment, the MAC processor 118 is configured to generate timing packets using the timing messages received from the main processor 120. The timing packets generated by the MAC processor 118 include Ethernet frames. For example, in one embodiment, the timing packets are generated as user datagram protocol (UDP) packets over Internet Protocol version 6 (IPv6). In another embodiment, the timing packets are generated as packets of another suitable type, such as UDP over Internet Protocol version 4 (IPv4), data link (L2) layer protocol packets, etc. In one embodiment, the MAC processor 118 encapsulates the timing messages from the main processor 120 using one or more protocol headers, labels, etc. to generate the timing packets.

[0036] The MAC processor 118 is configured to, in turn, communicate timing packets to the appropriate PHY processor 108 for transmission of packets from the network port 104 of the network device 100 .

[0037] Figure 1 MAC processor 118 is shown transmitting timing packet 152 to PHY processor 108-2. In one embodiment, timing packet 152 corresponds to a UDP packet over IPv6. In another embodiment, timing packet 152 corresponds to another suitable type of packet, such as UDP over IPv4, L2 layer protocol packet, etc.

[0038] Timing packet 152 includes timing message 156. In one embodiment, timing message 156 is generated by timing controller 126 of host processor 120. In one embodiment, timing message 156 is Figure 2 In other embodiments, the timing message 156 is a suitable timing message other than the timing message 200.

[0039] Timing packet 152 also includes control header 160. As will be discussed further below, in one embodiment, control header 160 includes information indicating whether timing packet 152 is processed using one-step timestamping or two-step timestamping.

[0040] In one embodiment, the MAC processor 118 includes or implements a timing controller 162 that is configured to process timing messages for transmission from the network device 100. In one embodiment, the timing controller 162 is configured to process PTP messages, such as, in some embodiments, PTP synchronization messages, Pdelay-Req messages, Pdelay-Resp messages, etc. In other embodiments, the timing controller 126 is configured to generate other suitable types of timing messages.

[0041] The timing controller 162 includes a header modification engine 164 configured to generate a control header, such as a control header 160, for a timing message received from the host processor 120. In one embodiment, the header modification engine 164 is configured to generate the control header 160 to include information indicating whether the timing packet 152 is processed using one-step timestamping or two-step timestamping. For example, the header modification engine 164 is configured to generate the control header 160 to include a first field having a value indicating whether the timing packet 152 is processed using one-step timestamping or two-step timestamping. In one embodiment, the header modification engine 164 sets the first field of the control header 160 to a first value to indicate that the timing packet 152 is to be processed using one-step timestamping, and sets the first field of the control header 160 to a second value to indicate that the timing packet 152 is to be processed using two-step timestamping.

[0042] In one embodiment, the header modification engine 164 is further configured to generate the control header 160 to include other suitable information for use by the PHY processor 108-2 in processing the timing packet 152. For example, in one embodiment, the header modification engine 164 generates the control header 160 to include one or more parameters in one or more second fields of the control header 160 that indicate to the PHY processor 108-2 that the PHY processor 108-2 is to update the timing information in the timing packet 152 when one-step timestamping is to be performed and to locate a field in the timing packet 152 in which to embed the timing information update. In one embodiment, the one or more parameters indicate to the PHY processor at least two of the following: i) the timing packet 152 includes a type of timing message into which the timing information is to be embedded by the PHY processor 108-2, ii) the location of a field in the timing packet 152 at which the timing information is to be embedded by the PHY processor 108-2 in the timing packet 152, and iii) whether the timing information in the timing packet needs to be updated by the PHY processor.

[0043] In some embodiments, the control header 160 includes one or more additional indicators to facilitate updating of timing information by the PHY processor 108-2 when performing one-step timestamping. As an example, the one or more additional indicators in the control header 160 include one or more of the following: i) an indicator of the location of the correction field 206 in the timing message 156 in the timing packet 152 to enable the PHY processor 108-2 to locate and update the correction field 206 without parsing the timing packet 152 to determine the location of the correction field 206 in the timing packet 152, ii) an indicator of whether a checksum field is present in the timing message 156 in the timing packet 152, iii) an indicator of a time application interface (TAI) field for embedding timing information in the timing packet 152, and iv) an indicator of whether wraparound needs to be considered with respect to embedding timing information in the timing packet 152. In other embodiments, the MAC processor 118 additionally or alternatively provides other suitable indicators to the PHY processor 108-2 to enable the PHY processor 108-2 to effectively embed timing information into the timing packet 152 being processed in real time when the timing packet 152 is transmitted from the network device 100 when a one-step timestamping is to be performed.

[0044] In other embodiments, when performing one-step timestamping, the MAC processor 118 additionally or alternatively provides other suitable indicators to the PHY processor 108-2 to enable the PHY processor 108-2 to effectively embed timing information into the timing packet 152 being processed during transmission when the timing packet 152 is transmitted from the network device 100.

[0045] In other embodiments, one-step timestamping includes embedding a "future timestamp" corresponding to a future transmission time in the timing packet 152, holding the timing packet 152 until the current time reaches the transmission time, and then releasing the timing packet for transmission at the transmission time (referred to herein as the "future timestamp"). Examples of future timestamping methods and apparatus that can be used are disclosed in U.S. Patent No. 8,644,352, entitled "System and Method for Accurate Time Sampling in Presence of Output Delay," and U.S. Patent Application Publication No. 2020 / 0252320, entitled "Method and Apparatus for Transmit Time Timestamping," which are incorporated herein by reference. In some embodiments in which one-step timestamping involves the use of future timestamping techniques, the header modification engine 164 is configured to generate a control header 160 to include an indication of a transmission time at which the timing packet 152 is to be transmitted in the future.

[0046] In some embodiments, the header modification engine 164 is configured to generate a control header 160 for the timing packet 152 and append the control header 160 to the timing packet 152 or embed the control header 160 into the timing packet 152. In various embodiments, the following reference FIG. 3A to FIG. 3B An example control header generated for timing packet 152 is described in more detail.

[0047] Continue to refer Figure 1 , the MAC processor 118 is configured to communicate the timing packet 152 to the appropriate PHY processor 108 (eg, the PHY processor 108 - 2 ) for transmitting the timing packet 152 from the network port 104 (eg, the network port 104 - 2 ).

[0048] The PHY processor 108-2 is configured to receive the timing packet 152 from the MAC processor 118 and use the information in the control header 160 to determine whether to i) perform one-step timestamping on the timing packet 152 or ii) perform two-step timestamping on the timing packet 152. In embodiments where the control header 160 includes the first field described above, the timestamping controller 124 of the PHY processor 108-2 is configured to: i) determine that one-step timestamping is to be performed in response to determining that the first field of the control header 160 is set to a first value, and ii) determine that two-step timestamping is to be performed in response to determining that the first field of the control header 160 is set to a second value.

[0049] In some embodiments, the timestamping controller 124 of the PHY processor 108-2 is configured to determine whether to perform one-step timestamping on the timing packet 152 or to perform two-step timestamping on the timing packet 152 further in response to other information in the control header 160. For example, in some embodiments, the control header 160 also includes information indicating whether to perform timestamping on the packet. In some such embodiments, the timestamping controller 124 is configured to: i) determine that one-step timestamping is to be performed in response to determining that a) the first field of the control header 160 is set to a first value, and b) the other information in the control header 160 indicates that timestamping is to be performed on the packet; and ii) determine that two-step timestamping is to be performed in response to determining that a) the first field of the control header 160 is set to a second value, and b) the other information in the control header 160 indicates that timestamping is to be performed on the packet.

[0050] In one embodiment, the egress timestamping engine 110 is configured to embed timing information into the timing packet 152 when one-step timestamping is to be performed. In one embodiment, because the initial timing information has already been embedded into the timing packet 152 by the MAC processor 118 or the host processor 118 (when one-step timestamping is to be performed), the PHY processor 108 only needs to update the relevant timing information in the timing packet 152 to indicate the actual transmission time of the timing packet 152 from the network device 100. For example, in one embodiment, the egress timing module 110 is configured to update the correction field value (e.g., in the correction field 206) in the timing message 156 in the timing packet 152 to add the current value (e.g., the current nanosecond value) of the PHY clock 113 to the correction value.

[0051] In one embodiment, the egress timing module 110 is configured to embed timing information into the timing packet 152 based on one or more indicators provided by the MAC processor 118 to the PHY processor 108-2 when one-step timestamping is to be performed. For example, the egress timing module 110 is configured to update the correction value of the correction field 206 at the location determined by the PHY processor 108-2 based on an indicator of the location of the correction field provided by the MAC processor 118 (e.g., included in the control header 160). As another example, in one embodiment, the PHY processor 108-2 is configured to determine whether the checksum trailer field is present in the timing packet 152 and needs to be updated by the PHY processor 108-2 based on the indicator provided by the MAC processor 118, and if so, update the checksum trailer field in the timing packet 152.

[0052] Embedding the final timing information into the packet 152 by updating the timing information already included in the timing packet 152, as performed by the PHY processor 108-1, is computationally less intensive than a system in which a higher level processor, such as a MAC processor or a host processor, does not embed the initial timing information into the timing packet. In addition, because the relevant indicator for embedding the timing information into the timing packet 152 is provided to the PHY processor 108-2 by the MAC processor 118, in various embodiments, the PHY processor 108-2 does not need to parse the timing packet 152, for example, to determine the location of the correction field 206 in the timing message 140 in the timing packet 152 and / or to determine whether a checksum trailer field is present in the timing message 140 in the timing packet 152 and needs to be updated by the PHY processor 108-2. Thus, in at least some embodiments, the PHY processor 108-2 is implemented with reduced hardware, reducing power consumption, cost, etc. compared to a system in which the PHY processor is configured to perform a one-step timestamping of processing without an indicator provided by the MAC processor and / or without initial timing information being embedded in the timing packet by the MAC processor or host processor.

[0053] In embodiments where one-step timestamping involves timestamping in the future, when one-step timestamping is to be performed, the PHY processor 108-2 holds the timing packet 152 until the current time reaches the transmission time, and then releases the timing packet 152 for transmission at the transmission time. In some embodiments where the control header 160 includes an indication of the transmission time at which the timing packet 152 is to be transmitted in the future, the PHY processor 108-2 determines the transmission time by retrieving the transmission time from the control header 160.

[0054] The egress timestamping engine 110 is configured to store timing information corresponding to the timing packet 152 in the memory 115 when two-step timestamping is to be performed. In one embodiment, the PHY processor 108-2 subsequently retrieves the timing information from the memory 115 and transmits the timing information to the host processor 120 so that the host processor 120 can transmit the timing information in a subsequent packet. In another embodiment, the host processor 120 subsequently retrieves the timing information from the memory 115 so that the host processor 120 can transmit the timing information in a subsequent packet.

[0055] Continue to refer Figure 1In embodiments and / or scenarios where the network device 100 operates as a relay device, the PHY processor 108 is configured to receive a timing packet received by the network device 100 via the first network port 104, generate a receive timestamp of the timing packet indicating an ingress time of the timing packet, and transmit the timing packet to the MAC processor 118. The MAC processor 118 is configured to process the timing packet, locate a correction field within the timing packet, and update the correction field in the timing packet to reflect a residence time of the timing packet in the network device 100. The MAC processor 118 is then configured to transmit the timing packet to the appropriate PHY processor 108 for transmission of the timing packet from the second network port 104 of the network device 100.

[0056] Still reference Figure 1 and Figure 2 In one embodiment, the timing packet 152 is a timing packet received by the PHY processor 108 (e.g., the PHY processor 108-1) from the network port 104 (e.g., the network port 104-1). In one embodiment, when the network device 100 receives the timing packet 152, the ingress timing module 112 of the PHY processor 108-1 generates a reception timestamp for the timing packet 152, which corresponds to the reception time or ingress time of the timing packet 152 by the network device 100. The PHY processor 108-1 then transmits the timing packet 152 and the reception timestamp generated for the timing packet 152 to the MAC processor 118. In one embodiment, the PHY processor 108-1 generates a control header for the timing packet 152, embeds the timestamp into the control header, and transmits the timing packet 152 with the control header to the MAC processor 118. In one embodiment, the PHY processor 108-1 replaces the preamble of the timing packet 152 with the control header generated for the timing packet 152 and transmits the timing packet with the control header to the MAC processor 118. In other embodiments, the PHY processor 108-1 transmits the timestamp generated for the timing packet 152 to the MAC processor 118 in other suitable manners.

[0057] The timing packets received from the PHY processor 108-1 include Ethernet frames. For example, in one embodiment, the timing packets are UDP packets over IPv6. In another embodiment, the timing packets are packets of another suitable type, such as UDP over IPv4, L2 layer protocol packets, etc.

[0058] In one embodiment, the MAC processor 118 is configured to determine whether the timing packet received from the PHY processor 108-1 is processed using one-step timestamping or two-step timestamping. For example, according to an embodiment, the MAC processor 118 determines the type of timing message in the timing packet received from the PHY processor 108-1, and determines whether to use one-step timestamping or two-step timestamping for the timing packet based on the determined type of timing message. In an embodiment where the timing packet already includes a control header as described above, the MAC processor 118 determines whether to use one-step timestamping or two-step timestamping for the timing packet based on an indicator in the control header 160 (e.g., the first field described above), the indicator indicating whether to use one-step timestamping or two-step timestamping for the timing packet.

[0059] In one embodiment, the header modification engine 164 of the MAC processor 118 is further configured to process the timing packets received by the MAC processor 118 from the PHY processor 108 (e.g., the PHY processor 108-1), at least for the timing packets to be processed using one-step timestamping, to locate and update a correction field in a timing message included in the timing packets to indicate a residence time of the timing packets in the network device 100. In one embodiment, the header modification engine 164 is configured to process the timing packets 152 received from the PHY processor 108-1, at least for the timing packets to be processed using one-step timestamping, and to locate and update a correction field 206 of the timing message 140 in the timing packets 152 to indicate a residence time of the timing packets 152 in the network device 100. In one embodiment, the header modification engine 164 is configured to update the correction field 206 of the timing message 140 by subtracting the ingress time of the timing packet 152 indicated by the receive timestamp generated by the PHY processor 108-1 for the timing packet 152 from the current correction value of the correction field 206. In one embodiment, the header modification engine 164 is further configured to add an egress pipeline delay to the correction field value of the correction field 206, wherein the egress pipeline delay is a preconfigured value of a static delay from a point at which the PHY processor 108 timestamps the timing packet to an egress pin of the PHY processor 108 via which the timing packet is emitted from the PHY processor 108.

[0060] In an embodiment, when two-step timestamping is to be performed, the MAC processor 118 sends a receive timestamp indicating the ingress time of the timing packet 152 to the host processor 120, which uses the receive timestamp to calculate the residence time of the timing packet in the network device 100. With two-step timestamping, the network device 100 sends the residence time in subsequent packets.

[0061] In embodiments where the timing packet 152 received from the PHY processor 108-1 does not already include a control header 160, the header modification engine 164 generates the control header 160. In one embodiment, the header modification engine 164 is configured to generate the control header 160 to include information indicating whether the timing packet 152 is processed using one-step timestamping as described above or two-step timestamping. In one embodiment, the header modification engine 164 is also configured to generate the control header 160 to include other suitable information used by the PHY processor 108-2 for processing the timing packet 152, as described above.

[0062] In one embodiment, in embodiments where the timing packet 152 received from the PHY processor 108-1 already includes a control header 160, the header modification engine 164 is configured to modify the control header 160 to include information indicating whether the timing packet 152 is to be processed using one-step timestamping or two-step timestamping as described above. In one embodiment, the header modification engine 164 is also configured to modify the control header 160 to include other suitable information used by the PHY processor 108-2 for processing the timing packet 152 as described above.

[0063] Continue to refer Figure 1 , the MAC processor 118 is configured to communicate the timing packet 152 to the appropriate PHY processor 108 (eg, the PHY processor 108 - 2 ) for transmitting the timing packet 152 from the network port 104 (eg, the network port 104 - 2 ).

[0064] The PHY processor 108-2 is configured to receive the timing packet 152 from the MAC processor 118 and use the information in the control header 160 to determine whether to i) perform one-step timestamping on the timing packet 152 or ii) perform two-step timestamping on the timing packet 152. According to an embodiment, when one-step timestamping is to be performed, the egress timestamping engine 110 updates the timing information in the timing packet 152 in the manner described above, such as updating the correction field 206 to indicate the residence time of the timing packet 152 in the network device. In an embodiment where one-step timestamping involves future timestamping, when one-step timestamping is to be performed, the PHY processor 108-2 holds the timing packet 152 until the current time reaches the transmission time, and then releases the timing packet 152 for transmission at the transmission time. When two-step timestamping is to be performed, the egress timestamping engine 110 stores the timing information in the memory 115 in the manner described above, so that the host processor 120 can use the timing information in the memory 115 to calculate the residence time of the timing packet 152 in the network device. The host processor 120 then sends the dwell time in a subsequent packet.

[0065] In some embodiments, the PHY processor 108 - 2 is configured to remove the control header 160 from the timing packet 152 such that the timing packet 152 does not include the control header 160 when transmitted by the PHY processor 108 - 2 .

[0066] Figure 3A is a simplified diagram of an example control header 300 included in a timing packet, in accordance with an embodiment. In one embodiment, the control header 300 is generated by the host processor 120 for a timing message to be provided to the MAC processor 118.

[0067] In one embodiment, the control header 300 generally conforms to a known control header format specified for a media independent interface, such as a Universal Serial 10GE Media Independent Interface (USXGMII) or a Universal Serial Gigabit Media Independent Interface (USGMII). However, in one embodiment, the control header 300 is modified relative to the known control header format specified for a media independent interface. In the illustrated embodiment, the control header 300 includes a packet type field 302, a subport identifier (Id) field 304, an extension field type indicator field 306, an extension field 308, and a cyclic redundancy check (CRC) field 310. In various embodiments, the control header 300 omits the packet type field 302, a subport identifier (Id) field 304, an extension field type indicator field 306, an extension field 308, and a cyclic redundancy check (CRC) field 310. Figure 3A One or more of the fields 302 to 310 shown in and / or including Figure 3A One or more additional fields not shown.

[0068] In one embodiment, the main processor 120 is configured to generate a control header 300 for a timing message to be transmitted by the network device 100 and append the control header 300 to the timing message. In another embodiment, the main processor 120 does not generate a control header 300 and does not append the control header 300 to the timing message.

[0069] Figure 3B is a simplified diagram of another example control header 340 included in a timing packet according to another embodiment. The control header 340 is similar to Figure 3A 3. In one embodiment, control header 340 is an example control header 300 of FIG. 1, and like numbered elements are not described in detail for the sake of brevity. In one embodiment, control header 340 is control header 300 after control header 300 has been modified.

[0070] According to an embodiment, a control header 340 is generated by the PHY processor 108 (e.g., the PHY processor 108-1) for a timing packet received by the PHY processor 108 via the network link 106. In one embodiment, the PHY processor (e.g., the PHY processor 108-1) is configured to generate the control header 340 for the timing packet received via the network link 106, and insert the control header 340 at a predetermined position within the timing packet. For example, the PHY processor 108-1 is configured to replace the preamble at the beginning of the timing packet with the control header 340.

[0071] The PHY processor 108-1 is configured to include a timestamp 344 corresponding to the reception time of the packet in the extension field 308 of the control header 340. The PHY processor 108-1 is also configured to set the value of the extension field type field 306 to indicate that the extension field 308 includes a timestamp. In one embodiment, the timestamp 344 included in the extension field 308 occupies 32 bits of the extension field 308. In another embodiment, the timestamp 344 included in the extension field 308 occupies a suitable number of bits other than 32 bits (e.g., 16 bits, 48 ​​bits, 64 bits, or any other suitable number of bits). In one embodiment, the PHY processor 108-1 is configured to include the timestamp as a 32-bit unsigned value of the PHY clock 113 in nanoseconds when the packet is received. In another embodiment, the PHY processor 108-1 is configured to include the timestamp in the control header 340 in another suitable format. For example, in one embodiment, the timestamp is in the IEEE Time Application Interface (TAI) format, with a 2-bit seconds value followed by a 30-bit nanoseconds value.

[0072] The MAC processor 118 is configured to receive a timing packet having a control header 340 from the PHY processor 108-1 and obtain a timestamp 344 from the extension field 308 of the control header 340. In one embodiment, the MAC processor 118 is configured to pass the timestamp value to the host processor 120 in an appropriate format. In one embodiment, the MAC processor 118 is configured to convert the timestamp value into a format suitable for transmission to the host processor 120. In some embodiments, the MAC processor 118 is configured to modify the timestamp value, such as by subtracting an ingress pipeline delay from the timestamp value, and transmit the modified timestamp value to the host processor 120. In one embodiment, the MAC processor 118 is configured to generate a timestamp tag (TST) for the packet so that the timestamp value is included in the timestamp value in an appropriate format and transmit the timestamp tag with the packet to the host processor 120. In one embodiment, the host processor 120 is configured to synchronize with the master clock using the timestamp 344 obtained from the control header 340. In another embodiment, the MAC processor 118 is configured to internally utilize the timestamp 344 obtained from the control header 300, for example, to update a correction field in the timing packet 152 to reflect the residence time of the timing packet 152 as described above.

[0073] Figure 3C is a simplified diagram of another example control header 370 included in a timing packet according to another embodiment. The control header 340 is similar to Figure 3A An example control header 300 and Figure 3B , and for the sake of brevity, the same numbered elements are not described in detail. In one embodiment, the control header 370 is generated to have Figure 3C In another embodiment, control header 370 is control header 300 that follows modified control header 300. In another embodiment, control header 370 is control header 340 that follows modified control header 340.

[0074] refer to Figure 1In one embodiment, the MAC processor 118 is configured to insert a control header 370 into a timing packet corresponding to a timing message received from the host processor 120 before transmitting the timing packet to the PHY processor (e.g., the PHY processor 108-2) to transmit the timing packet via the network port 104 (e.g., the network port 104-2). In one embodiment, the control header 370 is inserted into the timing packet at a predetermined position within the timing packet. For example, in one embodiment, the control header 370 replaces the preamble at the beginning of the timing packet. In another embodiment, the MAC processor 118 is configured to modify a control header (e.g., the control header 300 or the control header 340) that is already present in the timing packet to generate the control header 370. For example, in one embodiment, the MAC processor 118 is configured to modify the control header 300 or the control header 340 of the timing packet received from the PHY processor (e.g., the PHY processor 108-1) to generate the control header 370 before transmitting the timing packet to another PHY processor (e.g., the PHY processor 108-2) for transmission of the timing packet via the network port 104 (e.g., the network port 104-2).

[0075] In one embodiment, the extension field 308 of the control field 370 is generated or modified to include a timestamping type field 374. In one embodiment, the MAC processor 118 is configured to generate the control header 370 with the timestamping type field 374 for the timing message received from the host processor 120, and append the control header 370 to the timing message. In another embodiment, the MAC processor 118 is configured to generate the timestamping type field 374 for the timing message to which the control header 300 or the control header 340 has been appended, and insert the timestamping type field 374 into the extension field 308 when received from the host processor 120 or from the PHY processor 108.

[0076] In one embodiment, the timestamping type field 374 includes information indicating whether the timing packet 152 is processed using one-step timestamping or two-step timestamping. For example, the header modification engine 164 ( Figure 1 ) is configured to generate the timestamping type field 374 to include a value indicating whether the timing packets are to be processed using one-step timestamping or two-step timestamping. In one embodiment, the header modification engine 164 sets the timestamping type field 374 to a first value to indicate that the timing packets are to be processed using one-step timestamping, and sets the timestamping type field 374 to a second value to indicate that the timing packets are to be processed using two-step timestamping.

[0077] In one embodiment, the MAC processor 118 is further configured to include in the packet type field 302 of the control header 370 an indicator indicating that the timing packet is a packet type for which any type of timestamping is to be performed by the PHY processor. For example, for one or more packet types, the PHY processor 108-2 will not perform any timestamping, e.g., will not perform one-step timestamping and will not perform two-step timestamping. In one embodiment, when the PHY processor determines (e.g., the timestamping controller 124 determines) based on the value of the packet type field 302 that timestamping is to be performed, the PHY processor is configured to determine whether to perform one-step timestamping or two-step timestamping based on information in the timestamping type field 374. In one embodiment, the PHY processor 108-2 is configured to perform embedding the timing information into the timing packet in response to i) determining based on the packet type field 302 that the timing packet is a packet type for which timestamping is to be performed, and ii) determining based on the information in the timestamping type field 374 that one-step timestamping is to be performed. In one embodiment, the PHY processor 108-2 is configured to store the timing information in the memory 115 in response to i) determining, based on the packet type field 302, that the timing packet is a packet type for which timestamping is to be performed, and ii) determining, based on information in the timestamping type field 374, that two-step timestamping is to be performed.

[0078] The MAC processor 118 is configured to generate an extension field 308 to include one or more indicators of one or more parameters required by the PHY processor 108-2 to embed timing information into the packet when one-step timestamping is to be performed, the timing information indicating a time corresponding to the transmission of the packet from the network device 100 or a residence time of the timing packet in the network device 100.

[0079] The MAC processor 118 is configured to generate the extension field 308 to include a subfield including identifier information (e.g., a "signature") identifying the timing packet to facilitate subsequent matching of the timing packet with transmission timing information transmitted in subsequent packets when two-step timestamping is to be performed.

[0080] According to an embodiment, when the PHY processor 108-2 receives a timing packet having a control header 370, the PHY processor 108-2 is configured to determine whether the PHY processor 108-2 is to perform timestamping on the timing packet by analyzing at least the packet type field 302. When the PHY processor 108-2 determines that timestamping is to be performed on the timing packet, the PHY processor 108-2 is configured to determine whether the PHY processor 108-2 is to perform one-step timestamping or two-step timestamping on the timing packet by analyzing at least the timestamping type field 374.

[0081] When the PHY processor 108-2 determines that one-step timestamping is to be performed on the timing packet, the PHY processor 108-2 is configured to obtain one or more indicators for embedding timing information into the timing packet from the control header 370 (e.g., from the extension field 308). For example, according to one embodiment, the PHY processor 108-2 is configured to obtain an indication of a location within the timing packet to write the timing information to the timing packet from the control header 370 (e.g., from the extension field 308). The PHY processor 108-2 is configured to write the timing information into the timing packet (e.g., at the determined location) that indicates a time corresponding to the transmission of the packet from the network device 100 and / or a residence time of the timing packet in the network device 100.

[0082] When the PHY processor 108-2 determines that two-step timestamping is to be performed on the timing packet, the PHY processor 108-2 is configured to obtain the signature from the control header 370 (e.g., from the extension field 308). The PHY processor 108-2 is configured to write timing information in association with the signature to the memory 115, the timing information indicating a time corresponding to the transmission of the packet from the network device 100 and / or a residence time of the timing packet in the network device 100. In one embodiment, writing the timing information in association with the signature to the memory 115 includes writing the timing information and the signature to the same memory location in the memory 115, or to different memory locations associated with each other. Writing the timing information to the memory 115 in association with the signature allows the host processor 120 to subsequently determine to which packet the timing information corresponds.

[0083] The header modification engine 164 of the MAC processor 118 is implemented using hardware circuitry, a processor executing machine-readable instructions, or a suitable combination of hardware circuitry and a processor executing machine-readable instructions. In one embodiment, the header modification engine 164 is implemented using a hardware state machine configured to perform actions such as those described above.

[0084] The timestamping controller 124 of the PHY processor 108-2 is implemented using a hardware circuit, a processor that executes machine-readable instructions, or an appropriate combination of a hardware circuit and a processor that executes machine-readable instructions. In one embodiment, according to one embodiment, the timestamping controller 124 is implemented using a hardware state machine configured to perform actions such as those described above. The egress timestamping engine 110 and the ingress timestamping engine 112 of the PHY processor 108-2 are implemented using a hardware circuit, one or more processors that execute machine-readable instructions, or an appropriate combination of a hardware circuit and one or more processors that execute machine-readable instructions. In one embodiment, according to one embodiment, the egress timestamping engine 110 and the ingress timestamping engine 112 are implemented using corresponding hardware state machines configured to perform actions such as those described above.

[0085] Figure 4 is a flow chart of an example method 400 for processing timing packets in a network device according to an embodiment. In one embodiment, Figure 1 The network device 100 implements the method 400, and for ease of description only, reference is made to Figure 1 The method 400 is described with reference to the network device 100 of FIG. 1 . In other embodiments, the method 400 is performed by a network device 100 different from Figure 1 The network device 100 may be implemented as an appropriate network device.

[0086] At block 404, a first processor of the network device determines a timestamping method for communicating timing information corresponding to a first packet transmitted by the network device to a receiving device. The timestamping method determined by the first processor at block 404 is selected from a set of multiple timestamping methods, and a second processor of the network device is configured to perform the set of multiple timestamping methods, the set of multiple timestamping methods comprising: i) a one-step timestamping method, and ii) a two-step method. The one-step timestamping method involves the network device embedding the timing information in the first packet, and the two-step method involves the network device storing the timing information in a memory of the network device, so that the network device can subsequently transmit the timing information to the receiving device in a second packet after transmitting the first packet.

[0087] In one embodiment, the network device is configured to transmit a plurality of different types of timing messages, and determining the timestamping method at block 404 includes determining the timestamping method based on a type of the timing message corresponding to the first packet (e.g., included in the first packet or to be included in the first packet). For example, in an illustrative embodiment, the plurality of different types includes a first set of one or more types and a second set of one or more types. In some such embodiments, when the type of the timing message corresponding to the first packet is from the first set of one or more types, the first processor determines the timestamping method as a one-step timestamping method at block 404, and when the type of the timing message corresponding to the first packet is from the second set of one or more types, the first processor determines the timestamping method as a two-step timestamping method at block 404.

[0088] In one embodiment, determining the time stamping method at block 404 includes determining the time stamping method by the timing controller 126 of the host processor 120. In another embodiment, determining the time stamping method at block 404 includes determining the time stamping method by the timing controller 162 of the MAC processor 118. In other embodiments, another suitable processor determines the time stamping method at block 404.

[0089] At block 408, the first processor transmits to the second processor i) a timing message corresponding to the first packet, and ii) information indicating a timestamping method determined by the controller. In one embodiment, transmitting the timing message at block 408 includes transmitting the first packet including the timing message to a timestamping engine.

[0090] In one embodiment, the transmitting at block 408 includes the host processor 120 transmitting i) a timing message corresponding to the first packet, and ii) information indicating a time stamping method to the MAC processor 118. In another embodiment, the transmitting at block 408 additionally or alternatively includes the MAC processor 118 transmitting i) the first packet including the timing message, and ii) information indicating a time stamping method to the PHY processor 108.

[0091] At block 412, the second processor processes the information indicating the time stamping method received at block 408 to determine which time stamping method is to be performed by the second processor. When the second processor determines that one-step time stamping is to be performed, flow proceeds to block 416.

[0092] In one embodiment, the first processor generates a control header including information indicating a timestamping method and inserts the control header into the first packet before transmitting the first packet from the first processor to the second processor; and determining which timestamping method is to be performed by the second processor in box 412 includes the second processor analyzing the control header to determine which timestamping method is to be performed by the second processor.

[0093] At block 416, the second processor determines timing information corresponding to the network device transmitting the first packet to the receiving device. For example, at block 416, the second processor determines the timing information using a clock (eg, PHY clock 113 or another suitable clock).

[0094] At block 420, the second processor embeds the timing information into the first packet. In one embodiment, the timing message includes a timestamp field, and embedding the timing information into the first packet at block 420 includes embedding the timing information into a correction field of the timing message that is different from the timestamp field. For example, PHY processor 108-1 embeds the timing information into correction field 206 ( Figure 2 ), and the timestamp is stored in the timestamp field 208. In one embodiment, the value of the timestamp field is determined based on a first clock of the network device (e.g., the master clock 128), and the timing information in the correction field is determined based on a second clock of the network device (e.g., the PHY clock 113).

[0095] On the other hand, when the second processor determines at block 412 that two-step timestamping is to be performed, the flow proceeds to block 424. At block 424, the second processor determines timing information corresponding to the transmission of the first packet by the network device to the receiving device. For example, at block 424, the second processor uses a clock to determine the timing information. In one embodiment, the timing information is determined at block 424 based on a clock of the network device (e.g., PHY clock 113).

[0096] At block 428, the second processor stores the timing information in a memory of the network device for subsequent inclusion in a second packet to be transmitted by the network device subsequent to the transmission of the first packet.

[0097] At block 432, the network device transmits a first packet from the network device to the receiving device. In some embodiments where the control header is inserted or appended to the first packet, the network device removes the control header from the packet so that when the first packet is transmitted at block 432, the first packet does not include the control header.

[0098] In one embodiment, determining the timing information at block 416 and determining the timing information at block 424 are implemented as a single action performed, regardless of whether one-step timestamping or two-step timestamping is performed.

[0099] In one embodiment, the timing message is received by the first processor from a third processor (eg, main processor 120), and the first processor generates a first packet by at least encapsulating the timing message with one or more communication protocol headers.

[0100] In an embodiment: transmitting i) a timing message, and ii) information indicating a timestamping method at box 408 includes: transmitting i) a timing message and ii) information indicating a timestamping method from a MAC processor of the network device (e.g., MAC processor 118) to a PHY processor of the network device (e.g., PHY processor 108-1); determining which timestamping method to execute at box 412 includes: the PHY processor determining which timestamping method to execute by the PHY processor based on the PHY processor analyzing the information indicating the timestamping method; in response to the PHY processor determining that a one-step method is to be executed by the PHY processor, the PHY processor embedding the timing information in the first packet at box 420; and in response to the PHY processor determining that a timestamping method is to be executed by the PHY processor, the PHY processor storing the timing information in a memory at box 428.

[0101] In some embodiments where the one-step timestamping method includes a future timestamping technique, blocks 416 and 420 are replaced by the network device holding the first packet until the current time reaches the transmission time and then releasing the first packet for transmission at the transmission time.

[0102] Figure 5 is a block diagram of another example network device 500 configured to transmit time-stamped packets in a network according to another embodiment. The network device 500 includes Figure 1 The present invention relates to some identical components of the network device 100, and for the sake of brevity, the elements with the same number will not be described in detail.

[0103] The network device 500 is configured to operate according to a synchronization protocol for timing synchronization. In an embodiment, the network device 500 is configured to operate according to the IEEE 802.1AS standard. In another embodiment, the network device 500 is configured to operate according to another synchronization protocol (such as PTP, NTP or another suitable synchronization protocol).

[0104] In an embodiment, network device 500 includes a MAC processor 504 communicatively coupled to host processor 120. In an embodiment, MAC processor 504 is implemented using one or more integrated circuits (eg, one or more application specific integrated circuits (ASICs)).

[0105] The MAC processor 504 is also communicatively coupled to one or more network ports 508. In an embodiment, the MAC processor 504 is configured to receive packets from the network port 508, perform MAC operations on the packets received from the network port 508, such as parsing and decapsulating the packets, and transmit the packets to the host processor 120 for further processing. In an embodiment, the MAC processor 504 is also configured to receive messages from the host processor 120, perform MAC operations on the messages received from the host processor 120, such as encapsulating the messages with one or more protocol headers to generate packets, and transmit the packets to the appropriate one or more network ports 508 for transmission from the network device 500.

[0106] The one or more network ports 508 are configured to couple to corresponding one or more network links 106 for coupling the network device 500 to one or more other devices in the network.

[0107] In various embodiments, the MAC processor 504 includes any suitable combination of one or two or more of a DAC, an amplifier, a modulator, etc. (not shown) to convert a digital signal corresponding to a packet into an analog signal suitable for transmission via the communication link 106. The MAC processor 504 also includes timing-related circuits to implement timing synchronization operations. For example, in an embodiment, the MAC processor 504 includes an egress timestamping engine 510 and an ingress timestamping engine 512. In an embodiment, the egress timestamping engine 510 is configured to i) generate timing information based on a clock maintained by the MAC clock 513, the timing information corresponding to the transmission time of the timing packet from the network device 500, and ii) selectively a) embed the timing information into the timing packet itself, or ii) store the timing information in the memory 515 on a per-packet basis. In an embodiment, embedding the timing information into the timing packet itself corresponds to one-step timestamping, and storing the timing information in the memory 515 corresponds to two-step timestamping.

[0108] In an embodiment, the ingress timestamping engine 512 is configured to generate a timestamp for a received timing packet based on a clock maintained by the MAC clock 513 , the timestamp corresponding to the time of receipt of the timing packet by the network device 500 .

[0109] In an embodiment, the egress timestamping engine 510 and the ingress timestamping engine 512 are implemented in hardware configured to perform on-the-fly operations at line rate. For example, in an embodiment, the egress timestamping engine 510 is configured to generate timing information on-the-fly corresponding to the transmission time of the packet as the packet is being transmitted by the network device 500, and when one-step timestamping is to be performed, the timing information is embedded in the packet as the packet is transmitted from the network device 500. In an embodiment, the ingress timestamping engine 512 is configured to generate a timestamp for the packet on-the-fly as the packet is received by the network device 500.

[0110] although Figure 5 A single MAC processor 504 is shown, but in other embodiments, the network device 500 includes a corresponding plurality of MAC processors 504 coupled to one or more sets of ports 508 .

[0111] In embodiments and / or scenarios where the network device 500 operates as an endpoint device, the host processor 120 is configured to generate timing messages originating from the network device 500 .

[0112] In an embodiment, the host clock 128 used by the host processor 120 to generate initial timing information for the timing packets is less accurate than the MAC clock 513. For example, in an embodiment, the host clock 128 maintains the time of day with an accuracy of one or a few milliseconds, while the MAC clock 513 maintains the time of day with an accuracy of one or a few nanoseconds. As will be explained in greater detail below, when one-step timestamping is implemented, the egress timestamping engine 510 subsequently updates the correction fields (e.g., correction field 206) of the timing packets based on the MAC clock 513 as the timing packets are transmitted from the network device 500. In at least some embodiments, the updating of the correction fields by the MAC processor 504 based on the MAC clock 513 compensates for the inaccuracy of the host clock 128.

[0113] In an embodiment, when one-step timestamping is to be used, the timing controller 126 generates a correction field value that is equal to the negative value of the nanosecond portion of the timestamp in the timestamp field 208, so that when the timing packet 152 is transmitted from the network device 500, the MAC processor 504 can subsequently update the nanosecond portion of the timestamp based on the MAC clock 513. In an embodiment, the timing controller 126 also adds the egress pipeline delay to the correction field value, where the egress pipeline delay is a preconfigured value of a static delay from the point at which the MAC processor 504 timestamped the timing packet to the egress pin of the MAC processor 504 via which the timing packet is sent from the MAC processor 504.

[0114] In some embodiments, the timing controller 126 encapsulates the timing message in a UDP datagram. In some embodiments where the timing message is encapsulated in a UDP datagram having a checksum field, the timing controller 126 adjusts the checksum field based on the values ​​of the timestamp field 208 and the correction field 206 to maintain the correctness of the checksum field of the UDP datagram.

[0115] The main processor 120 is configured to transmit the timing message to the MAC processor 504. In some embodiments, transmitting the timing message to the MAC processor 504 includes transmitting to the MAC processor 504 a UDP datagram encapsulating the timing message.

[0116] According to an embodiment, in conjunction with transmitting the timing message to the MAC processor 504, the timing controller 126 is configured to indicate to the MAC processor 504 whether one-step timestamping or two-step timestamping is used for the timing message. In other embodiments, the timing controller 126 does not indicate to the MAC processor 504 whether one-step timestamping or two-step timestamping is used for the timing message. For example, in some embodiments, the MAC processor 504 determines whether one-step timestamping or two-step timestamping is used for the timing message without relying on an indication from the host processor 120. For example, according to an embodiment, the MAC processor 504 determines the type of timing message received from the host processor 120, and determines whether one-step timestamping or two-step timestamping is used for the timing message based on the determined type of the timing message.

[0117] According to an embodiment, the MAC processor 504 is configured to generate timing packets using the timing messages received from the main processor 120. The timing packets generated by the MAC processor 504 include Ethernet frames. For example, in an embodiment, the timing packets are generated as UDP packets over IPv6. In another embodiment, the timing packets are generated as packets of another suitable type, such as UDP over IPv4, L2 layer protocol packets, etc. In an embodiment, the MAC processor 504 encapsulates the timing messages from the main processor 120 with one or more protocol headers, labels, etc. to generate timing packets.

[0118] In an embodiment, the MAC processor 504 includes or implements a timing controller 532 that is configured to process timing messages for transmission from the network device 500. In an embodiment, the timing controller 532 is configured to process PTP messages, such as PTP synchronization messages, p delay-request messages, p delay-response messages, etc. In other embodiments, the timing controller 532 is configured to process other suitable types of timing messages.

[0119] The timing controller 532 includes the above reference Figure 1 The header modification engine 164 described above. In an embodiment, the header modification engine 164 is configured to generate the control header 160 to include information indicating whether to process the timing packet 152 using one-step timestamping or two-step timestamping. For example, the header modification engine 164 is configured to generate the control header 160 to include a first field having a value indicating whether to process the timing packet 152 using one-step timestamping or two-step timestamping. In an embodiment, the header modification engine 164 sets the first field of the control header 160 to a first value to indicate that the timing packet 152 is to be processed using one-step timestamping, and sets the first field of the control header 160 to a second value to indicate that the timing packet 152 is to be processed using two-step timestamping.

[0120] In an embodiment, the header modification engine 164 is further configured to generate the control header 160 to include other suitable information used by the MAC processor 504 for processing the timing packet 152. For example, in an embodiment, the header modification engine 164 generates the control header 160 to include one or more parameters in one or more second fields of the control header 160 that indicate that when one-step timestamping is to be performed, the MAC processor 504 is to update the timing information in the timing packet 152 and locate the field in the timing packet 152 in which to embed the timing information update. In an embodiment, the one or more parameters indicate at least two of the following: i) the timing packet 152 includes a type of timing message into which the timing information is to be embedded, ii) the location of the field in the timing packet 152 into which the timing information is to be embedded, and iii) whether the timing information in the timing packet needs to be updated.

[0121] In some embodiments, the control header 160 includes one or more additional indicators to facilitate timing information updates by the MAC processor 504 when one-step timestamping is to be performed. As an example, the one or more additional indicators in the control header 160 include one or more of the following: i) an indicator of the location of the correction field 206 in the timing message 156 in the timing packet 152 to enable the MAC processor 504 to locate and update the correction field 206 without parsing the timing packet 152 again to determine the location of the correction field 206 in the timing packet 152, ii) an indicator of whether a checksum field is present in the timing message 156 in the timing packet 152, iii) an indicator of the TAI field for embedding timing information into the timing packet 152, and iv) an indicator of whether wraparound needs to be considered when embedding timing information into the timing packet 152. In other embodiments, other suitable indicators are additionally or alternatively generated to enable the MAC processor 504 to embed timing information into the timing packet 152 effectively on-the-fly when the timing packet 152 is transmitted from the network device 500 when one-step timestamping is to be performed.

[0122] In some embodiments, the control header 160 is not generated and / or used, and in an embodiment, the timing controller 532 is configured to generate one or more control signals indicating whether to process the timing packet 152 using one-step timestamping or two-step timestamping. In an embodiment, the timing controller 532 is also configured to generate other appropriate information for processing the timing packet 152. For example, in an embodiment, the timing controller 532 generates one or more control signals indicating that the timing information in the timing packet 152 is to be updated when one-step timestamping is to be performed, and indicating the location of the field in the timing packet 152 where the timing information is to be updated. In an embodiment, the one or more control signals generated by the MAC processor 504 indicate at least two of the following: i) the timing packet 152 includes a type of timing message into which the timing information is to be embedded by the PHY processor 108-2, ii) the location of the field in the timing packet 152 into which the timing information is to be embedded, and iii) whether the timing information in the timing packet needs to be updated.

[0123] In some embodiments where the control header 160 is not generated and / or used, the timing controller 532 generates one or more additional control signals to facilitate the updating of the timing information when one-step timestamping is to be performed. As an example, the one or more additional control signals include one or more of the following: i) an indicator of the location of the correction field 206 in the timing message 156 in the timing packet 152, so that the correction field 206 can be located and updated without further parsing the timing packet 152 to determine the location of the correction field 206 in the timing packet 152, ii) an indicator of whether a checksum field is present in the timing message 156 in the timing packet 152, iii) an indicator for embedding the timing information into the TAI field in the timing packet 152, and iv) an indicator of whether wraparound needs to be considered when embedding the timing information into the timing packet 152.

[0124] In other embodiments, one-step timestamping includes embedding a "future timestamp" corresponding to a future transmit time in the timing packet 152, holding the timing packet 152 until the current time reaches the transmission time, and then releasing the timing packet for transmission at the transmission time (referred to herein as the "future timestamp"). Examples of future timestamping methods and apparatus that can be used are disclosed in U.S. Patent No. 8,644,352, entitled "System and Method for Accurate Time Sampling in Presence of Output Delay," and U.S. Patent Application Publication No. 2020 / 0252320, entitled "Method and Apparatus for transmit time timestamping," which are incorporated herein by reference. In some embodiments in which one-step timestamping involves the use of future timestamping techniques, the header modification engine 164 is configured to generate a control header 160 to include an indication of a transmission time of a future transmit timing packet 152. In other embodiments where one step of timestamping involves using a future timestamping technique and where the control header 160 is not generated and / or used, the timing controller 532 is configured to generate an indication of a transmission time of a future transmission timing packet 152 .

[0125] In some embodiments, the header alteration engine 164 is configured to generate a control header 160 for the timing packet 152 and append the control header 160 to the timing packet 152 or embed the control header 160 into the timing packet 152 .

[0126] In some embodiments, the egress timestamping engine 510 and / or the ingress timestamping engine 512 are configured to determine whether to perform one-step timestamping on the timing packets 152 or to perform two-step timestamping on the timing packets 152 also in response to other information in the control header 160. For example, in some embodiments, the control header 160 also includes information indicating whether to perform timestamping on the packet. In some such embodiments, the egress timestamping engine 510 and / or the ingress timestamping engine 512 are configured to: i) determine to perform one-step timestamping in response to determining that a) the first field of the control header 160 is set to a first value, and b) the other information in the control header 160 indicates that timestamping is to be performed on the packet; and ii) determine to perform two-step timestamping in response to determining that a) the first field of the control header 160 is set to a second value, and b) the other information in the control header 160 indicates that timestamping is to be performed on the packet.

[0127] In an embodiment, the egress timestamping engine 510 is configured to embed timing information into the timing packet 152 when one-step timestamping is to be performed. In an embodiment, because the initial timing information has already been embedded in the timing packet 152 by the MAC processor 504 or the host processor 120 (e.g., when one-step timestamping is to be performed), the egress timestamping engine 510 only needs to update the relevant timing information in the timing packet 152 to indicate the actual transmission time of the timing packet 152 from the network device 500. For example, in an embodiment, the egress timestamping engine 510 is configured to update the correction field value (e.g., in the correction field 206) in the timing message 156 in the timing packet 152 to add the current value of the MAC clock 513 (e.g., the current nanosecond value) to the correction value.

[0128] In an embodiment, the egress timestamping engine 510 is configured to embed timing information into the timing packet 152 based on one or more indicators provided by the timing controller 532 when one-step timestamping is to be performed. For example, the egress timestamping engine 510 is configured to update the correction value of the correction field 206 at the location determined by the timing controller 532 based on an indicator of the location of the correction field provided by the timing controller (e.g., included in the control header 160). As another example, in an embodiment, the egress timestamping engine 510 is configured to determine whether the checksum trailer field is present in the timing packet 152 and needs to be updated based on the indicator provided by the timing controller 532, and if so, update the checksum trailer field in the timing packet 152.

[0129] In embodiments where one-step timestamping involves a future timestamping, when one-step timestamping is to be performed, the MAC processor 504 holds the timing packet 152 until the current time reaches the transmission time, and then releases the timing packet 152 for transmission at the transmission time. In some embodiments where the control header 160 includes an indication of a transmission time for a future transmission timing packet 152, the MAC processor 504 determines the transmission time by retrieving the transmission time from the control header 160.

[0130] The egress timestamping engine 510 is configured to store timing information corresponding to the timing packet 152 in the memory 515 when two-step timestamping is to be performed. In an embodiment, the MAC processor 504 subsequently retrieves the timing information from the memory 515 and sends the timing information to the host processor 120 so that the host processor 120 can send the timing information in a subsequent packet. In another embodiment, the host processor 120 subsequently retrieves the timing information from the memory 515 so that the host processor 120 can send the timing information in a subsequent packet.

[0131] Continue to refer Figure 5In embodiments and / or scenarios where the network device 500 operates as a relay device, the MAC processor 504 is configured to receive a timing packet received by the network device 500 via the first network port 508, and to generate a reception timestamp of the timing packet indicating an ingress time of the timing packet. The MAC processor 504 is also configured to process the timing packet to locate a correction field within the timing packet, and to update the correction field in the timing packet to reflect the residence time of the timing packet in the network device 500. The MAC processor 504 is then configured to transmit the timing packet to the second network port 508 for transmission from the network device 500.

[0132] Still reference Figure 2 and Figure 5 In an embodiment, the timing packet 152 is a timing packet received from the network port 508 (e.g., the network port 508-1). In an embodiment, when the network device 500 receives the timing packet 152, the ingress timestamping engine 512 generates a reception timestamp of the timing packet 152, which corresponds to the reception time or ingress time of the timing packet 152 by the network device 500.

[0133] The timing packets received from port 508 include Ethernet frames. For example, in an embodiment, the timing packets are UDP packets over IPv6. In another embodiment, the timing packets are packets of another suitable type, such as UDP over IPv4, L2 layer protocol packets, etc.

[0134] In an embodiment, the MAC processor 504 is configured to determine whether to use one-step timestamping or two-step timestamping to process the timing packet. For example, according to an embodiment, the MAC processor 504 determines the type of timing message in the received timing packet, and determines whether to use one-step timestamping or two-step timestamping for the timing packet based on the determined type of timing message. In an embodiment where the timing packet already includes a control header as described above, the MAC processor 504 determines whether to use one-step timestamping or two-step timestamping for the timing packet based on an indicator in the control header 160 (e.g., the first field described above), the indicator indicating whether to use one-step timestamping or two-step timestamping for the timing packet.

[0135] In an embodiment, the header modification engine 164 is further configured to process the timing packets received from the port 508 to locate and update a correction field in a timing message included in the timing packet to indicate a residence time of the timing packet in the network device 500, at least for the timing packets to be processed using one-step timestamping. In an embodiment, the header modification engine 164 is configured to process the timing packets 152 received from the port 508 to locate and update a correction field 206 of a timing message 156 in the timing packets 152 to indicate a residence time of the timing packet 152 in the network device 500, at least for the timing packets to be processed using one-step timestamping. In an embodiment, the header modification engine 164 is configured to update the correction field 206 of the timing message 156 by subtracting an ingress time of the timing packet 152 from a current correction value of the correction field 206, the ingress time being indicated by a receive timestamp generated for the timing packet 152 by the ingress timestamping engine 512. In an embodiment, the header modification engine 164 is further configured to add an egress pipeline delay to the correction field value of the correction field 206, wherein the egress pipeline delay is a preconfigured value of a static delay from a point at which the MAC processor 504 timestamps the timing packet to an egress pin of the MAC processor 504 via which the timing packet is emitted from the MAC processor 504.

[0136] In an embodiment, when two-step timestamping is to be performed, the MAC processor 504 sends a receive timestamp indicating the ingress time of the timing packet 152 to the host processor 120, which uses the receive timestamp to calculate the residence time of the timing packet in the network device 500. With two-step timestamping, the network device 500 sends the residence time in subsequent packets.

[0137] In embodiments where the timing packet 152 received from the port 508 does not yet include a control header 160, the header modification engine 164 generates information indicating whether the timing packet 152 is to be processed using one-step timestamping or two-step timestamping as described above in embodiments. In embodiments, the header modification engine 164 is also configured to generate the control header 160 to include other suitable information used by the MAC processor 504 for processing the timing packet 152 as described above.

[0138] In embodiments where the timing packet 152 received by the MAC processor 504 already includes a control header 160, the header modification engine 164 is configured to modify the control header 160 to include information indicating whether the timing packet 152 is processed using one-step timestamping or two-step timestamping as described above in an embodiment. In an embodiment, the header modification engine 164 is also configured to modify the control header 160 to include other suitable information used by the MAC processor 504 for processing the timing packet 152 as described above.

[0139] According to an embodiment, when one-step timestamping is to be performed, the egress timestamping engine 510 updates the timing information in the timing packet 152 in the manner described above, such as updating the correction field 206, to indicate the residence time of the timing packet 152 in the network device 500. In an embodiment where one-step timestamping involves a future timestamping, when one-step timestamping is to be performed, the MAC processor 504 holds the timing packet 152 until the current time reaches the transmission time, and then releases the timing packet 152 for transmission at the transmission time. When two-step timestamping is to be performed, the egress timestamping engine 510 stores the timing information in the memory 515 in the manner described above, so that the host processor 120 can use the timing information in the memory 515 to calculate the residence time of the timing packet 152 in the network device 500. The host processor 120 then sends the residence time in a subsequent packet.

[0140] In some embodiments, the MAC processor 504 is configured to remove the control header 160 from the timing packet 152 such that the timing packet 152 does not include the control header 160 when transmitted via the port 508 .

[0141] The timestamp controller 532 is implemented using a hardware circuit, a processor that executes machine-readable instructions, or a suitable combination of a hardware circuit and a processor that executes machine-readable instructions. The egress timestamping engine 510 and the ingress timestamping engine 512 are implemented using a hardware circuit, one or more processors that execute machine-readable instructions, or a suitable combination of a hardware circuit and one or more processors that execute machine-readable instructions. In an embodiment, according to an embodiment, the egress timestamping engine 510 and the ingress timestamping engine 512 are implemented using corresponding hardware state machines configured to perform actions such as those described above.

[0142] although Figure 5 The network device 100 is shown with a single MAC processor 504 coupled to two ports 508, but in other embodiments, the network device 100 includes a separate MAC processor coupled to each port 508, each MAC processor having the same or similar structure as the MAC processor 504. In other embodiments, the network device 100 includes multiple MAC processors coupled to corresponding sets of one or more ports 508, each MAC processor having the same or similar structure as the MAC processor 504.

[0143] In an embodiment where the network device 500 includes multiple MAC processors 504 and the network device 500 operates as a relay device, the first MAC processor 504 is configured to receive a timing packet received by the network device 500 via the first network port 508 and generate a reception timestamp of the timing packet indicating an ingress time of the timing packet. The first MAC processor 504 then forwards the timing packet to the host processor 120 or a separate processor (e.g., a packet processor, not shown), which then forwards the timing packet to the second MAC processor 504. The second MAC processor 504 is configured to process the timing packet to locate a correction field within the timing packet and to update the correction field in the timing packet to reflect the residence time of the timing packet in the network device 500. The second MAC processor 504 is then configured to transmit the timing packet to the second network port 508 for transmission from the network device 500.

[0144] Figure 6 is a block diagram of another example network device 600 configured to transmit time-stamped packets in a network according to another embodiment. The network device 600 includes Figure 1 The network device 100 and Figure 5 The present invention also describes some of the same components of network device 500, and for the sake of brevity, the elements with the same number are not described in detail.

[0145] The network device 600 is configured to operate according to a synchronization protocol for timing synchronization. In an embodiment, the network device 600 is configured to operate according to the IEEE 802.1AS standard. In another embodiment, the network device 600 is configured to operate according to another synchronization protocol, such as PTP, NTP, or another suitable synchronization protocol.

[0146] In an embodiment, the network device 600 includes a packet processor 604 communicatively coupled to the host processor 120. The network device 600 is also coupled to a plurality of MAC processors 608. Each MAC processor 608 is coupled to a respective port 508. In other embodiments, each MAC processor 608 is coupled to a corresponding set of multiple ports 508. Figure 6 Two MAC processors 608 are shown, but in other embodiments, the network device 600 includes other suitable numbers of MAC processors 608. In various embodiments, the packet processor 604 and the MAC processor 608 are implemented using one or more integrated circuits (e.g., one or more ASICs). In some embodiments, the packet processor 604 is implemented on a first IC and the MAC processor 608 is implemented on one or more other ICs. In some embodiments, multiple MAC processors 608 are implemented on a single IC.

[0147] The MAC processor 608 is configured to receive packets via the port 508 and transmit the packets to the packet processor 604. The MAC processor 608 is also configured to receive packets from the packet processor 604 and transmit the packets via the port 508.

[0148] Packet processor 604 includes reference Figure 5 The timing controller 532 described herein. In an embodiment, the packet processor 604 includes a hardware pipeline processor, and the timing controller 532 includes one or more pipeline elements of the pipeline processor. In another embodiment, the packet processor 604 includes a plurality of processors configured to execute machine-readable instructions stored in one or more memories (not shown), wherein the timing controller 532 is implemented by one or more processors of the plurality of processors executing the machine-readable instructions.

[0149] MAC processor 608-1 includes an ingress timestamping engine 512 and MAC processor 608-2 includes an egress timestamping engine 510. In other embodiments, each MAC processor 608 includes a respective ingress timestamping engine 512 and a respective egress timestamping engine 510.

[0150] The packet processor 604 and the MAC processor 608 receive clock signals from a single clock 612. In other embodiments, the packet processor 604 receives a first clock signal from a first clock and the MAC processor 608 receives a clock signal from a second clock separate from the first clock. In other embodiments, the packet processor 604 receives a first clock signal from a first clock and the MAC processor 608 receives a clock signal from a respective second clock separate from the first clock, wherein each second clock is separate from the other second clocks. In some embodiments using independent clocks, the independent clocks are synchronized in frequency and / or phase.

[0151] As described above, in an embodiment, the timing controller 532 is configured to determine whether the timing packet is processed using one-step timestamping or two-step timestamping, and the header modification engine 164 is configured to generate the control header 160 to include information indicating whether the timing packet 152 is processed using one-step timestamping or two-step timestamping. The packet processor 604 then forwards the timing packet 152 to the MAC processor 608-2 for transmission via the port 508-2.

[0152] In conjunction with the MAC processor 608-2 receiving the timing packet 152 from the packet processor 604, the egress timestamping engine 510 is configured to store timing information corresponding to the timing packet 152 in the memory 515 when two-step timestamping is to be performed. In an embodiment, the MAC processor 608-2 subsequently retrieves the timing information from the memory 515 and sends the timing information to the packet processor 604 so that the packet processor 604 can send the timing information in a subsequent packet. In another embodiment, the MAC processor 608-2 subsequently retrieves the timing information from the memory 515 and sends the timing information to the packet processor 604, which in turn sends the timing information to the host processor so that the host processor 120 can send the timing information in a subsequent packet. In other embodiments, the packet processor 604 or the host processor 120 subsequently retrieves the timing information from the memory 515 so that the packet processor or the host processor 120 can send the timing information in a subsequent packet.

[0153] Figure 7 is a flow chart of an example method 700 for processing timing packets in a network device according to an embodiment. In an embodiment, Figure 1 The network device 100 implements the method 700, and for ease of description only, reference is made to Figure 1 The method 700 is described with reference to the network device 100. In another embodiment, Figure 5 The network device 500 implements the method 700, and for ease of description only, reference is made to Figure 5 The method 700 is described with reference to the network device 500. In another embodiment, Figure 6 The network device 600 implements the method 700, and for ease of description only, reference is made to Figure 6 The method 700 is described with reference to the network device 600. In other embodiments, the method 700 is performed by a network device different from Figure 1 The network device 100, Figure 5 Network device 500 and Figure 6 The network device 600 may be implemented as an appropriate network device.

[0154] At block 704, a processor of a network device receives i) a timing message and ii) a control header corresponding to the timing message. The control header includes information indicating a timestamping method used to convey timing information corresponding to the timing message transmitted by the network device. The timestamping method is selected from a set of multiple timestamping methods, and the network device is configured to perform the set of multiple timestamping methods, the set of multiple timestamping methods including: in an embodiment, i) a one-step timestamping method, and ii) a two-step timestamping method.

[0155] As an illustrative example, in an embodiment, the PHY processor 108-2 ( Figure 1) receives the timing message 156 and the control header 160. As another illustrative example, in another embodiment, the MAC processor 504 ( Figure 5 )'s egress timestamping engine 510 receives the timing message 156 and the control header 160. As another illustrative example, in another embodiment, the MAC processor 608-2 ( Figure 6 ) receives timing message 156 and control header 160.

[0156] In an embodiment, receiving the timing message and the control header at block 704 includes receiving the timing message within the first packet at the processor and receiving the control header within the first packet at the processor.

[0157] At block 708, the processor determines whether to perform a two-step timing timestamping method based on analyzing the information in the control header indicating the timestamping method. As an illustrative example, in an embodiment, the PHY processor 108-2 ( Figure 1 ) determines whether to perform a two-step timing timestamping method based on analyzing information indicating the timestamping method in the control header. As another illustrative example, in another embodiment, the MAC processor 504 ( Figure 5 )'s egress timestamping engine 510 determines whether to perform a two-step timing timestamping method based on analyzing information indicating a timestamping method in a control header. As another illustrative example, in another embodiment, the MAC processor 608-2 ( Figure 6 ) determines whether to perform a two-step timing timestamping method based on analyzing the information indicating the timestamping method in the control header.

[0158] In an embodiment, method 700 also includes retrieving, by the processor, information indicating a timestamping method from an extension field within a control header; wherein, at box 708, determining which timestamping method to execute by the processor includes analyzing, by the processor, information indicating a timestamping method extracted from the extension field of the control header.

[0159] At block 712, the network device transmits the first packet from the network device to the receiving device. In some embodiments where the control header is inserted or appended to the first packet, the network device removes the control header from the packet such that when the first packet is transmitted at block 712, the first packet does not include the control header.

[0160] At block 716, the processor determines timing information corresponding to transmission of the first packet by the network device. As an illustrative example, in an embodiment, the PHY processor 108-2 ( Figure 1 ) determines a timing message corresponding to the transmission of the first packet. As another illustrative example, in another embodiment, the MAC processor 504 ( Figure 5)'s egress timestamping engine 510 determines timing information corresponding to the transmission of the first packet. As another illustrative example, in another embodiment, the MAC processor 608-2 ( Figure 6 ) determines timing information corresponding to the transmission of the first packet.

[0161] In an embodiment where a two-step timestamping method is used for the first packet, the timing information determined at block 716 corresponds to the time at which the network device transmitted the first packet.

[0162] At block 720, in response to the processor determining at block 708 that the timestamping method is a two-step method, the processor stores the timing information in a memory for subsequent inclusion in a second packet to be transmitted by the network device after the first packet is transmitted. In some embodiments, the memory is included in or coupled to the processor. As an illustrative example, in an embodiment, the PHY processor 108-2( Figure 1 ) stores the timing information in memory 115. As another illustrative example, in another embodiment, MAC processor 504 ( Figure 5 )'s egress timestamping engine 510 stores the timing information in memory 515. As another illustrative example, in another embodiment, the MAC processor 608-2 ( Figure 6 )Store the timing information in memory 515.

[0163] In some embodiments, method 700 and Figure 4 For example, in response to the processor determining at block 708 that the timestamping method is a one-step method, the processor additionally performs blocks 416 and 420. As another example, the processor that performs elements of method 700 is a second processor, and the first processor performs Figure 4 Block 404 and block 408 of method 400 .

[0164] Embodiment 1: A network device configured to operate in a communication network, the network device comprising: a memory; and a processor, including or coupled to the memory. The processor is configured to: receive i) a timing message and ii) a control header corresponding to the timing message, the control header comprising information indicating a timestamping method for conveying timing information corresponding to the transmission of the timing message by the network device, the timestamping method being selected from a set of multiple timestamping methods, the network device being configured to execute a set of multiple timestamping methods, the set of multiple timestamping methods comprising: i) a one-step timestamping method, and ii) a two-step timestamping method; determine whether to execute the two-step timing timestamping method based on analyzing the information indicating the timestamping method in the control header; transmit a timing message within a first packet from the network device; determine the timing information corresponding to the first packet transmitted by the network device; and in response to the processor determining that the timestamping method is a two-step method, store the timing information in the memory for subsequent inclusion in a second packet, the second packet to be transmitted by the network device after the transmission of the first packet.

[0165] Embodiment 2: The network device of embodiment 1, wherein the processor is configured to: receive a timing message within the first packet; and receive a control header within the first packet.

[0166] Embodiment 3: Any network device in Embodiment 1 or Embodiment 2, wherein the processor is configured to: retrieve information indicating a timestamping method from an extension field within a control header; and determine which timestamping method is to be executed by the processor at least by analyzing the information indicating the timestamping method extracted from the extension field of the control header.

[0167] Embodiment 4: According to any network device of embodiments 1 to 3, the processor is further configured to: in response to the processor determining that the timestamping method is a one-step method, embed the timing information into the first packet.

[0168] Embodiment 5: The network device of embodiment 4, wherein the processor is further configured to: in response to the processor determining that the timestamping method is a one-step method, embed the timing information into a correction field of the timing message, the correction field being different from the timestamp field of the timing message.

[0169] Embodiment 6: Any network device of Embodiment 1 to Embodiment 5, wherein: the processor is a first processor; the network device also includes a second processor coupled to the first processor, the second processor being configured to transmit to the first processor i) a first packet and ii) a control header corresponding to the first packet.

[0170] Embodiment 7: The network device of embodiment 6, wherein the second processor is further configured to: determine a timestamping method for conveying timing information corresponding to the transmission of a timing message; and generate a control header based on the timestamping method determined for conveying timing information corresponding to the transmission of a timing message.

[0171] Embodiment 8: The network device of embodiment 7, wherein: the network device is configured to transmit multiple timing messages of different types; and the second processor is configured to determine the timestamping method based on the timing message type corresponding to the first packet.

[0172] Embodiment 9: The network device of embodiment 8, wherein: the multiple different types include a first set of one or more types and a second set of one or more types; the second processor is configured to determine the timestamping method as a one-step timestamping method when the timing message type corresponding to the first packet comes from the first set of one or more types; and the second processor is configured to determine the timestamping method as a two-step timestamping method when the timing message type corresponding to the first packet comes from the second set of one or more types.

[0173] Embodiment 10: Any network device of Embodiment 1 to Embodiment 9, wherein: the processor comprises a media access control (MAC) processor.

[0174] Embodiment 11: A method for processing timing packets in a network device, the method comprising: receiving at a processor of the network device i) a timing message and ii) a control header corresponding to the timing message, the control header comprising information indicating a timestamping method for conveying timing information corresponding to the timing message transmitted by the network device, the timestamping method being selected from a set of multiple timestamping methods, the network device being configured to execute the set of multiple timestamping methods, the set of multiple timestamping methods comprising: i) a one-step timestamping method, and ii) a two-step timestamping method; determining at the processor whether to execute the two-step timing timestamping method based on analyzing the information in the control header indicating the timestamping method; transmitting a timing message within a first packet by the network device; determining at the processor the timing information corresponding to the first packet transmitted by the network device; and in response to the processor determining that the timestamping method is a two-step method, storing the timing information in a memory by the processor for subsequent inclusion in a second packet, the second packet to be transmitted by the network device after the first packet is transmitted, the memory being included in the processor or coupled to the processor.

[0175] Embodiment 12: The method for processing a timing packet of embodiment 11, wherein receiving a timing message and a control header comprises: receiving a timing message within a first packet at a processor; and receiving a control header within the first packet at the processor.

[0176] Embodiment 13: Any method for processing timing packets in Embodiment 11 or Embodiment 12, further comprising: retrieving, by a processor, information indicating a timestamping method from an extension field within a control header; wherein determining which timestamping method to be executed by the processor comprises: analyzing, by the processor, the information indicating the timestamping method extracted from the extension field of the control header.

[0177] Embodiment 14: Any method for processing timing packets in Embodiments 11 to 13 further includes: in response to the processor determining that the timestamping method is a one-step method, the processor embeds the timing information into the first packet.

[0178] Embodiment 15: The method for processing timing packets of embodiment 14, wherein embedding timing information into the first packet comprises: in response to the processor determining that the timestamping method is a one-step method, embedding the timing information into a correction field of the timing message, the correction field being different from the timestamping field of the timing message.

[0179] Embodiment 16: Any method for processing timing packets in Embodiments 11 to 15, wherein: the processor is a first processor; and the method further comprises: a second processor of a network device coupled to the first processor transmits to the first processor i) a first packet and ii) a control header corresponding to the first packet.

[0180] Embodiment 17: The method for processing timing packets of Embodiment 16 further includes: determining, by a second processor, a timestamping method for conveying timing information corresponding to the transmission of a timing message; and generating, by the second processor, a control header based on the determined timestamping method for conveying timing information corresponding to the transmission of a timing message.

[0181] Embodiment 18: Any method for processing timing packets in Embodiment 16 or Embodiment 17, wherein: the network device is configured to transmit multiple timing messages of different types; and the method also includes determining, by a second processor, a timestamping method based on the type of timing message corresponding to the first packet.

[0182] Example 19: A method for processing timing packets of Example 18, wherein the multiple different types include a first set of one or more types and a second set of one or more types, and the method further includes: when the type of the timing message corresponding to the first packet comes from the first set of one or more types, the second processor determines the timestamping method as a one-step timestamping method; and when the type of the timing message corresponding to the first packet comes from the second set of one or more types, the second processor determines the timestamping method as a two-step timestamping method.

[0183] Embodiment 20: A method for processing timing packets according to any of Embodiments 11 to 19, wherein: receiving i) a timing message and ii) a control header is performed by a media access control (MAC) processor of a network device; determining whether a two-step timing timestamping method is to be performed is performed by the MAC processor; determining timing information corresponding to the transmission of a first packet is performed by the MAC processor; and storing the timing information in a memory includes: storing the timing information in a memory included in the MAC processor or in a memory coupled to the MAC processor.

[0184] At least some of the various blocks, operations, and techniques described above are suitably implemented using dedicated hardware, such as one or more discrete components, integrated circuits, ASICs, programmable logic devices (PLDs), processors that execute firmware instructions, processors that execute software instructions, or any combination thereof. When implemented using a processor that executes software or firmware instructions, the software or firmware instructions may be stored in any suitable computer-readable memory, such as a random access memory (RAM), a read-only memory (ROM), a solid-state memory, etc. The software or firmware instructions may include machine-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the various actions described herein.

[0185] Although the present invention has been described with reference to specific embodiments, these embodiments are merely illustrative and not restrictive of the present invention. Changes, additions and / or deletions may be made to the disclosed embodiments without departing from the scope of the present invention.

Claims

1. A network device configured to operate in a communication network, the network device comprising: Storage devices, and A processor, including or coupled to the memory, the processor being configured to: receiving i) a timing message and ii) a control header corresponding to the timing message, the control header including information indicating a timestamping method for communicating timing information corresponding to the timing message transmitted by the network device, the timestamping method being selected from a set of multiple timestamping methods, the network device being configured to perform the set of multiple timestamping methods, the set of multiple timestamping methods comprising: i) a one-step timestamping method, and ii) a two-step timestamping method, determining whether the two-step timestamping method is to be performed based on analyzing the information in the control header indicating the timestamping method, transmitting the timing message within a first packet from the network device, determining timing information corresponding to transmission of the first packet by the network device, and In response to the processor determining that the timestamping method is the two-step method, storing the timing information in the memory for subsequent inclusion in a second packet to be transmitted by the network device after transmitting the first packet.

2. The network device according to claim 1, wherein the processor is configured to: receiving the timing message in the first packet; and The control header is received within the first packet.

3. The network device according to claim 1, wherein the processor is configured to: retrieving said information indicating said timestamping method from an extension field within said control header; and Which timestamping method is to be performed by the processor is determined by at least analyzing the information indicating the timestamping method extracted from the extension field of the control header.

4. The network device according to claim 1, wherein the processor is further configured to: In response to the processor determining that the timestamping method is the one-step method, the timing information is embedded in the first packet.

5. The network device according to claim 4, wherein the processor is further configured to: In response to the processor determining that the timestamping method is the one-step method, the timing information is embedded in a correction field of the timing message, the correction field being different from a timestamp field of the timing message.

6. The network device according to claim 1, wherein: The processor is a first processor; The network device also includes a second processor coupled to the first processor, the second processor configured to transmit to the first processor i) the first packet and ii) the control header corresponding to the first packet.

7. The network device according to claim 6, wherein the second processor is further configured to: determining the timestamping method for communicating the timing information corresponding to the transmission of the timing message; and The control header is generated based on determining the timestamping method for conveying the timing information corresponding to the transmission of the timing message.

8. The network device according to claim 7, wherein: The network device is configured to transmit a plurality of different types of timing messages; as well as The second processor is configured to determine the timestamping method based on a type of timing message corresponding to the first packet.

9. The network device according to claim 8, wherein: The plurality of different types includes a first set of one or more types and a second set of one or more types; The second processor is configured to, when the type of the timing message corresponding to the first packet is from the first set of the one or more types, determine the timestamping method as the one-step timestamping method; as well as The second processor is configured to determine the timestamping method as the two-step timestamping method when the type of the timing message corresponding to the first packet is from the second set of the one or more types.

10. The network device according to claim 1, wherein: The processor includes a media access control (MAC) processor.

11. A method for processing timing packets in a network device, the method comprising: receiving, at a processor of the network device, i) a timing message and ii) a control header corresponding to the timing message, the control header including information indicating a timestamping method for communicating timing information corresponding to the timing message transmitted by the network device, the timestamping method being selected from a set of multiple timestamping methods, the network device being configured to perform the set of multiple timestamping methods, the set of multiple timestamping methods comprising: i) a one-step timestamping method, and ii) a two-step timestamping method, determining, at the processor, whether the two-step timing timestamping method is to be performed based on analyzing the information in the control header indicating the timestamping method, transmitting, by the network device, the timing message in a first packet, determining, at the processor, timing information corresponding to transmission of the first packet by the network device, and In response to the processor determining that the timestamping method is the two-step method, the processor stores the timing information in the memory for subsequent inclusion in a second packet, which will be transmitted by the network device after transmitting the first packet, and the memory is included in the processor or coupled to the processor.

12. The method for processing a timing packet according to claim 11, wherein receiving the timing message and the control header comprises: receiving, at the processor, the timing message within the first packet; as well as The control header is received within the first packet at the processor.

13. The method for processing a timing packet according to claim 11, further comprising: retrieving, by the processor, the information indicating the timestamping method from an extension field within the control header; Wherein determining which time stamping method to be performed by the processor comprises: analyzing, by the processor, the information indicating the time stamping method extracted from an extension field of the control header.

14. The method for processing a timing packet according to claim 11, further comprising: In response to the processor determining that the timestamping method is the one-step method, the processor embeds the timing information in the first packet.

15. The method for processing a timing packet according to claim 14, wherein embedding the timing information into the first packet comprises: In response to the processor determining that the timestamping method is the one-step method, the timing information is embedded in a correction field of the timing message, the correction field being different from a timestamp field of the timing message.

16. The method for processing timing packets according to claim 11, wherein: The processor is a first processor; as well as The method also includes transmitting, by a second processor of the network device coupled to the first processor, to the first processor i) the first packet and ii) the control header corresponding to the first packet.

17. The method for processing a timing packet according to claim 16, further comprising: determining, by the second processor, the timestamping method for communicating the timing information corresponding to the transmission of the timing message; as well as The control header is generated, by the second processor, based on determining the timestamping method for conveying the timing information corresponding to the transmission of the timing message.

18. The method for processing timing packets according to claim 16, wherein: The network device is configured to transmit a plurality of different types of timing messages; as well as The method also includes determining, by the second processor, the timestamping method based on a type of timing message corresponding to the first packet.

19. The method for processing timing packets according to claim 18, wherein the plurality of different types comprises a first set of one or more types and a second set of one or more types, and the method further comprises: determining, by the second processor, the timestamping method as the one-step timestamping method when the type of the timing message corresponding to the first packet is from the first set of the one or more types; as well as The timestamping method is determined, by the second processor, to be the two-step timestamping method when the type of the timing message corresponding to the first packet is from the second set of the one or more types.

20. The method for processing timing packets according to claim 11, wherein: Receiving i) the timing message and ii) the control header is performed by a media access control (MAC) processor of the network device; determining whether the two-step timing timestamping method to be performed is to be performed by the MAC processor; determining the timing information corresponding to the transmission of the first packet is performed by the MAC processor; as well as Storing the timing information in the memory includes storing the timing information in a memory included in or coupled to the MAC processor.

Citation Information

Patent Citations

  • Method and apparatus for transmit time timestamping

    US20200252320A1

  • System and method for accurate time sampling in presence of output delay

    US8644352B1