CN117938292A - PTP message processing system, method and electronic equipment - Google Patents

PTP message processing system, method and electronic equipment Download PDF

Info

Publication number
CN117938292A
CN117938292A CN202311792000.5A CN202311792000A CN117938292A CN 117938292 A CN117938292 A CN 117938292A CN 202311792000 A CN202311792000 A CN 202311792000A CN 117938292 A CN117938292 A CN 117938292A
Authority
CN
China
Prior art keywords
message
ptp
time stamp
ptp message
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311792000.5A
Other languages
Chinese (zh)
Inventor
李欣
冉小庆
李昌辉
黄文龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Cncr Information Technology Co ltd
Original Assignee
Hangzhou Cncr Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Cncr Information Technology Co ltd filed Critical Hangzhou Cncr Information Technology Co ltd
Priority to CN202311792000.5A priority Critical patent/CN117938292A/en
Publication of CN117938292A publication Critical patent/CN117938292A/en
Pending legal-status Critical Current

Links

Abstract

The application relates to a PTP message processing system, a method and electronic equipment, wherein the system comprises a logic unit and a control unit, and the logic unit comprises a message receiving module, a message sending module, a time stamp generating module and a time stamp setting module; the control unit assembles the PTP message according to the message type and a preset rule and sends the PTP message to the logic unit, or analyzes the received PTP message to obtain a time stamp and records the time stamp; the message sending module receives and analyzes the PTP message sent by the control unit, and determines whether to send the PTP message to the time stamp setting module according to the analysis result; the message receiving module receives and analyzes the PTP message of the network side, and determines whether to send the PTP message to the time stamp setting module according to the analysis result; the time stamp generating module generates a time stamp according to the receiving time or the sending time of the PTP message; and the time stamp setting module fills the time stamp into the tail part of the PTP message and sends the PTP message to the control unit.

Description

PTP message processing system, method and electronic equipment
Technical Field
The present application relates to the field of network communications technologies, and in particular, to a PTP packet processing system, method, and electronic device.
Background
Currently, in order to ensure the normal operation of various real-time, on-line services, a high-precision clock system is required as a support. The PTP system is used as a clock system with high precision, high reliability and excellent network performance, has wide application prospect, and can be used in the fields of Internet, communication network, intelligent power grid, industrial control and the like.
The existing PTP time stamping scheme mainly uses PHY, SOC or FPGA with PTP function to stamp time, and generally uses RAM/FIFO mode to store time stamp. However, when a large number of PTP messages need to be received and processed or other reasons cause the CPU resources to be occupied, a problem that the PTP protocol stack is not enough to cover the acquired time stamp with a new time stamp easily occurs, so that the error of the PTP calculation result is larger.
Disclosure of Invention
The embodiment of the application provides a PTP message processing system, a PTP message processing method and electronic equipment, which are used for at least solving the problem of larger error of a PTP calculation result in the related technology.
In a first aspect, an embodiment of the present application provides a PTP packet processing system, including a logic unit and a control unit, where the logic unit includes a packet receiving module, a packet sending module, a timestamp generating module, and a timestamp setting module; wherein,
The control unit assembles the PTP message according to the message type and a preset rule and sends the PTP message to the logic unit, or analyzes the received PTP message to obtain a time stamp and records the time stamp;
The message sending module receives and analyzes the PTP message sent by the control unit, and determines whether to send the PTP message to the time stamp setting module according to the analysis result;
The message receiving module receives and analyzes the PTP message of the network side, and determines whether to send the PTP message to the time stamp setting module according to the analysis result;
the time stamp generating module generates a time stamp according to the receiving time or the sending time of the PTP message;
and the time stamp setting module fills the time stamp into the PTP message and sends the PTP message to the control unit.
In an embodiment, the control unit includes a PTP protocol stack packet processing module, and the control unit assembles a PTP packet according to a packet type and a preset rule, including:
the PTP protocol stack packet sending processing module generates a PTP message according to a PTP protocol, a message to be assembled, a message type and a preset rule;
wherein, the preset rule comprises:
if the message to be assembled is a general message, setting a reserved field of the PTP protocol as a first preset value;
if the message to be assembled is an event message and the message type is a one-step synchronous message, setting a reserved field of the PTP protocol as a second preset value;
If the message to be assembled is an event message and the message type is not a one-step synchronous message, the reserved field of the PTP protocol is set to a third preset value.
In an embodiment, the control unit includes a PTP protocol stack packet receiving processing module and a timestamp analyzing module, and the analyzing the received PTP packet to obtain a timestamp and record the timestamp includes:
The PTP protocol stack packet receiving processing module receives the PTP message sent by the time stamp setting module and forwards the PTP message to the time stamp analyzing module;
the time stamp analysis module judges whether the PTP message is an event message, and if the PTP message is not the event message, the PTP message is processed according to a corresponding PTP protocol;
if the event message is the event message, carrying out format analysis on the time information of the PTP message to obtain a time stamp, and judging whether a reserved field in the PTP message is a third preset value or not;
If the judgment result is yes, recording the sending time stamp of the PTP message; if the judgment result is "no", recording the receiving time stamp of the PTP message, and processing the PTP message according to the corresponding PTP protocol.
In an embodiment, the message sending module receives and parses the PTP message sent by the control unit, and determines whether to send the PTP message to the timestamp setting module according to the parsing result, including:
the message sending module judges the value of a reserved field in the PTP message;
If the reserved field in the PTP message is a third preset value, copying the PTP message and sending the PTP message to a time stamp setting module, and meanwhile, setting the reserved field of the PTP message to a fourth preset value by the message sending module and forwarding the fourth preset value to a network side;
If the reserved field in the PTP message is a second preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value, and forwards the PTP message to a network side after adding a time stamp;
If the reserved field in the PTP message is a first preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value and forwards the fourth preset value to the network side.
In an embodiment, the message receiving module receives and parses a PTP message at a network side, and determines whether to send the PTP message to a timestamp setting module according to a parsing result, including:
The message receiving module analyzes the PTP message and analyzes whether the PTP message is an event message;
If the PTP message is not an event message, the message receiving module forwards the PTP message to the control unit;
And if the PTP message is an event message, transmitting the PTP message to the timestamp setting module.
In an embodiment, the time stamp setting module fills the time stamp into a PTP packet and sends the PTP packet to a control unit, including:
The time stamp setting module acquires the time stamp from the time stamp generating module and converts the time stamp into a TLV format;
And writing the time stamp in the TLV format into the tail part of the PTP message.
In an embodiment, the PTP packet processing system further includes a switching chip for implementing data interaction between the logic unit and the control unit, and a PHY for implementing data interaction between the logic unit and the network side.
In a second aspect, an embodiment of the present application provides a PTP packet processing method, where the method is applied in a PTP packet processing system including a logic unit and a control unit, where the logic unit includes a packet receiving module, a packet sending module, a timestamp generating module, and a timestamp setting module;
When the control unit sends a message to the logic unit, the method comprises the following steps:
The control unit assembles a PTP message according to the message type and a preset rule, and sends the assembled PTP message to the message sending module; wherein, the preset rule comprises: if the message to be assembled is a general message, setting a reserved field of the PTP protocol as a first preset value; if the message to be assembled is an event message and the message type is a one-step synchronous message, setting a reserved field of the PTP protocol as a second preset value; if the message to be assembled is an event message and the message type is not a one-step synchronous message, setting a reserved field of the PTP protocol as a third preset value;
The message sending module judges the value of the reserved field in the PTP message, if the reserved field in the PTP message is a third preset value, the PTP message is copied and sent to the time stamp setting module, and meanwhile, the message sending module sets the reserved field of the PTP message to a fourth preset value and forwards the fourth preset value to the network side; if the reserved field in the PTP message is a second preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value, and forwards the PTP message to a network side after adding a time stamp in the PTP message; if the reserved field in the PTP message is a first preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value and forwards the fourth preset value to the network side.
In one embodiment, when the control unit receives the message sent by the logic unit, the method includes:
the message receiving module receives and analyzes the PTP message at the network side and judges whether the PTP message is an event message or not; if the PTP message is not an event message, the message receiving module forwards the PTP message to the control unit; if the PTP message is an event message, the PTP message is sent to the time stamp setting module, and the time stamp setting module fills the time stamp into the PTP message and forwards the PTP message to the control unit;
The control unit analyzes the received PTP message to obtain a time stamp and records the time stamp; analyzing whether the PTP message is an event message, if not, processing the PTP message according to a corresponding PTP protocol; if the event message is the event message, carrying out format analysis on the time information of the PTP message to obtain a time stamp, and judging whether a reserved field in the PTP message is a third preset value or not; if the judgment result is yes, recording the sending time stamp of the PTP message; if the judgment result is no, recording the receiving time stamp of the PTP message, and processing the PTP message according to the corresponding PTP protocol.
In a third aspect, an embodiment of the present application provides an electronic device, including a PTP packet processing system according to any of the foregoing embodiments.
The PTP message processing system, the PTP message processing method and the electronic equipment provided by the embodiment of the application have at least the following technical effects:
The time stamp is added to the messages sent by the CPU through the time stamp setting module, so that each PTP event message carries own time stamp, and even if a large number of messages need to be processed, the PTP protocol stack of the CPU is not processed, the error time stamp data cannot be taken, the problem of larger error of the PTP calculation result is solved, and the accuracy of the synchronization of the messages is ensured. In addition, for the CPU to send PTP event message, the FPGA increases the time stamp after receiving and transmits the time stamp back to the CPU, then the event message Wen Beifen is stored in the CPU, namely, after the exchange chip receives the PTP message, the time stamp can be analyzed and recorded, thereby saving hardware resources such as RAM/FIFO and the like.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the other features, objects, and advantages of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a block diagram of a PTP message processing system according to one embodiment of the present application;
FIG. 2 is a diagram of a frame format of a PTP message according to one embodiment of the present application;
FIG. 3 is a flow chart of a PTP message processing method according to an embodiment of the present application;
Fig. 4 is a flowchart of a PTP message processing method according to another embodiment of the application.
Detailed Description
The present application will be described and illustrated with reference to the accompanying drawings and examples in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application. All other embodiments, which can be made by a person of ordinary skill in the art based on the embodiments provided by the present application without making any inventive effort, are intended to fall within the scope of the present application.
It is apparent that the drawings in the following description are only some examples or embodiments of the present application, and it is possible for those of ordinary skill in the art to apply the present application to other similar situations according to these drawings without inventive effort. Moreover, it should be appreciated that while such a development effort might be complex and lengthy, it would nevertheless be a routine undertaking of design, fabrication, or manufacture for those of ordinary skill having the benefit of this disclosure, and thus should not be construed as having the benefit of this disclosure.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is to be expressly and implicitly understood by those of ordinary skill in the art that the described embodiments of the application can be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms used herein should be given the ordinary meaning as understood by one of ordinary skill in the art to which this application belongs. The terms "a," "an," "the," and similar referents in the context of the application are not to be construed as limiting the quantity, but rather as singular or plural. The terms "comprising," "including," "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to only those steps or elements but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. The terms "connected," "coupled," and the like in connection with the present application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as used herein means two or more. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., "a and/or B" may mean: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship. The terms "first," "second," "third," and the like, as used herein, are merely distinguishing between similar objects and not representing a particular ordering of objects.
In a first aspect, an embodiment of the present application provides a PTP packet processing system, where the system of this embodiment mainly includes an FPGA (logic unit) and a CPU (control unit). Referring to fig. 1, the FPGA includes a message receiving module, a message sending module, a timestamp generating module, and a timestamp setting module, and the CPU includes a PTP protocol stack packet receiving processing module, a PTP protocol stack packet sending processing module, and a timestamp analyzing module (for analyzing a timestamp and recording). In this embodiment, the CPU performs data interaction with the FPGA through a switch chip SW (switch), and the FPGA performs data interaction with the network side through a PHY (physical layer). The message receiving module is used for realizing PTP message receiving, the message sending module is used for realizing PTP message sending, the time stamp generating module is used for generating a time stamp, and the time stamp setting module obtains the time stamp, converts the time stamp into a TLV format and adds the time stamp into a corresponding PTP message.
The PTP protocol stack packet receiving processing module of this embodiment generates a PTP packet (may simply be referred to as a packet) according to the packet type and a preset rule, and sends the PTP packet to the FPGA; and the PTP protocol stack packet sending processing module receives the PTP message, and then the time stamp analysis module analyzes the message to obtain and record the time stamp. The message sending module receives and analyzes the PTP message sent by the CPU, and determines to send the PTP message to the physical layer or the timestamp setting module according to the analysis result; the message receiving module receives and analyzes the PTP message at the network side, and determines to send the PTP message to the CPU or the time stamp setting module according to the analysis result.
In this embodiment, the timestamp includes a transmission timestamp and a reception timestamp, where the reception timestamp is a reception time generated by the timestamp generating module when the PTP packet sent by the network side is received; the transmission time stamp is the transmission time generated by the time stamp generating module when the PTP message transmitted by the CPU is received. And the time stamp setting module fills the time stamp into the PTP message and sends the PTP message to the CPU.
Specifically, the message sending module of this embodiment first parses the type of the PTP message, and executes any one of the following three operations according to the parsing result: acquiring time data in the time modification message, setting the Reserved field to be 0, and then transmitting the message to the PHY; directly sending the message to a time stamp setting module; and setting RESERVEED field to be 0, and then directly transmitting the message to the PHY. The message receiving module analyzes the PTP message, distinguishes whether the message is a general message or an event message, if the general message is directly sent to the CPU, if the event message is sent to the time stamp setting module. And the time stamp setting module adds time stamp data near the tail part of the PTP event message, and the CPU receives the PTP event message, analyzes the time stamp data and records the sending/receiving time stamp.
And for the CPU to send the message, the CPU comprises a PTP protocol stack packet sending processing module, and the CPU generates a PTP message according to the message type and a preset rule. The PTP protocol stack packet sending processing module generates a PTP message according to a PTP protocol, a message to be assembled, a message type and a preset rule; the message to be assembled in this embodiment includes contents such as source MAC, destination MAC, vlan information, ptp message, FCS, message length, etc., and reference may be made to fig. 2.
Wherein, the preset rule comprises: if the PTP message to be generated by the CPU is a general message, setting a reserved field of the PTP message as a first preset value; if the PTP message to be generated by the CPU is an event message and the message type is a one-step synchronous message, setting a reserved field of the PTP message as a second preset value; if the PTP message to be generated by the CPU is an event message and the message type is not a one-step synchronous message, the reserved field of the PTP message is set to a third preset value.
In addition, the control unit comprises a PTP protocol stack packet receiving processing module and a timestamp analyzing module. And when the CPU receives the message, the received PTP message is analyzed to obtain a time stamp and recorded. Specifically, the PTP protocol stack packet receiving processing module receives the PTP message sent by the timestamp setting module and forwards the PTP message to the timestamp analyzing module; the time stamp analysis module judges whether the PTP message is an event message, and if the PTP message is not the event message, the PTP message is processed according to a corresponding PTP protocol; if the event message is the event message, carrying out format analysis on the time information of the PTP message to obtain a time stamp, and judging whether a reserved field in the PTP message is a third preset value or not; if the judgment result is yes, recording the sending time stamp of the PTP message; if the judgment result is "no", recording the receiving time stamp of the PTP message, and processing the PTP message according to the corresponding PTP protocol.
The message sending module of this embodiment receives and parses the PTP message sent by the CPU, and determines, according to the parsing result, to send the PTP message to the physical layer or the timestamp setting module. Specifically, the message sending module judges the value of a reserved field in the PTP message; if the reserved field in the PTP message is a third preset value, copying the PTP message and transmitting the PTP message to a time stamp setting module, wherein the time stamp setting module adds the transmitting time generated by the time stamp generating module to the copied PTP message and transmits the transmitting time back to the control unit, and meanwhile, the message transmitting module sets the reserved field of the PTP message to a fourth preset value and transmits the fourth preset value to the network side; if the reserved field in the PTP message is a second preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value, and forwards the PTP message to a network side after adding a time stamp; if the reserved field in the PTP message is a first preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value and forwards the fourth preset value to the network side.
For the message receiving module, the message receiving module of this embodiment receives and parses the PTP message forwarded by the physical layer, and determines to send the PTP message to the CPU or the timestamp setting module according to the parsing result. Specifically, the message receiving module analyzes a PTP message and judges whether the PTP message is an event message; if the PTP message is not an event message, the message receiving module directly forwards the message receiving module to the CPU; if the PTP message is an event message, the PTP message is sent to the time stamp setting module, and the time stamp setting module obtains the corresponding receiving time from the time stamp generating module and adds the corresponding receiving time to the PTP message.
The timestamp setting module of the embodiment fills the timestamp into a PTP message and sends the PTP message to a control unit, specifically, the timestamp setting module obtains the timestamp from the timestamp generating module and converts the timestamp into TLV format; the time stamp in TLV format is written into the tail of the PTP message, referring to fig. 2.
In a preferred embodiment, the PTP packet processing system further includes a switching chip for implementing data interaction between the logic unit and the control unit, and a PHY for implementing data interaction between the logic unit and the network side.
In summary, in the PTP message processing system provided by the application, the time stamp is added to the messages sent by the CPU through the time stamp setting module, so that each PTP event message carries its own time stamp, and even if the PTP protocol stack of the CPU is not processed, the time stamp data will not be taken, thereby solving the problem of larger error of the PTP calculation result and ensuring the accuracy of the synchronization of the messages. In addition, for the CPU to send PTP event message, the FPGA increases the time stamp after receiving and transmits the time stamp back to the CPU, then the event message Wen Beifen is stored in the CPU, namely, after the exchange chip receives the PTP message, the time stamp can be analyzed and recorded, thereby saving hardware resources such as RAM/FIFO and the like. In addition, the PTP message processing system is applicable to any network such as SPN, OTN, PTN, IPRAN, PON, so that the application range of the scheme of the application is wider.
In a second aspect, an embodiment of the present application provides a PTP packet processing method, which is applied in a PTP packet processing system including an FPGA (logic unit) and a CPU (control unit), where the FPGA includes a packet receiving module, a packet sending module, a timestamp generating module, and a timestamp setting module.
First, when the control unit sends a message to the logic unit, the method includes:
The control unit assembles a PTP message according to the message type and a preset rule, and sends the assembled PTP message to the message sending module; wherein, the preset rule comprises: if the message to be assembled is a general message, setting a reserved field of the PTP protocol as a first preset value; if the message to be assembled is an event message and the message type is a one-step synchronous message, setting a reserved field of the PTP protocol as a second preset value; if the message to be assembled is an event message and the message type is not a one-step synchronous message, setting a reserved field of the PTP protocol as a third preset value;
The message sending module judges the value of the reserved field in the PTP message, if the reserved field in the PTP message is a third preset value, the PTP message is copied and sent to the time stamp setting module, and meanwhile, the message sending module sets the reserved field of the PTP message to a fourth preset value and forwards the fourth preset value to the network side; if the reserved field in the PTP message is a second preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value, and forwards the PTP message to a network side after adding a time stamp in the PTP message; if the reserved field in the PTP message is a first preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value and forwards the fourth preset value to the network side.
Second, when the control unit receives the message sent by the logic unit, the method includes:
the message receiving module receives and analyzes the PTP message at the network side and judges whether the PTP message is an event message or not; if the PTP message is not an event message, the message receiving module forwards the PTP message to the control unit; if the PTP message is an event message, the PTP message is sent to the time stamp setting module, and the time stamp setting module fills the time stamp into the PTP message and forwards the PTP message to the control unit;
The control unit analyzes the received PTP message to obtain a time stamp and records the time stamp; analyzing whether the PTP message is an event message, if not, processing the PTP message according to a corresponding PTP protocol; if the event message is the event message, carrying out format analysis on the time information of the PTP message to obtain a time stamp, and judging whether a reserved field in the PTP message is a third preset value or not; if the judgment result is yes, recording the sending time stamp of the PTP message; if the judgment result is no, recording the receiving time stamp of the PTP message, and processing the PTP message according to the corresponding PTP protocol.
Referring to fig. 3, in the PTP message processing method of this embodiment, when the CPU sends a message to the FPGA, a PTP protocol stack (PTP protocol stack packet processing module) in the CPU sends a message, in this case, the PTP message is assembled in the CPU, and then sent to the FPGA through the switch chip, and after being parsed by the FPGA and adding time information, sent to the network side through the PHY or transmitted back to the CPU, where the CPU may parse and record the time information.
Firstly, a CPU constructs a PTP packet, where the PTP packet in this embodiment includes source mac, destination mac, vlan information, packet length, PTP protocol content, packet type, and the like, and meanwhile, a destination port of a switch (switch chip) needs to be configured according to a data interaction condition, so that a corresponding transmission packet driving interface of the switch chip is called according to the destination port, and then the assembled PTP packet is transmitted to the destination port of the switch chip.
In this embodiment, for assembling PTP messages, if the CPU sends a general message, the reserved field (i.e. reserved field) of the PTP message is set to "5", and such a message does not need to be returned to the CPU; if the CPU sends event messages, and meanwhile, the message types are sync and one step mode, the reserved field of the PTP message is set to be '6', and the messages do not need to be returned to the CPU; if the PTP message is in other cases, setting the reserved field of the PTP message as 7, and returning the message to the CPU, namely finishing the copying of the message in the FPGA and adding the time stamp to the message to return the CPU, wherein the CPU records the time stamp of the message. After the reserved field is set, the PTP message is sent to the switch chip SW.
For switch processing, after receiving a message sent by a CPU, the switching chip sends the message according to a designated destination port of the CPU.
For FPGA processing, the FPGA of the embodiment receives a message sent by a switch, and a message sending module in the FPGA analyzes a reserved field in the PTP message:
If the reserved is 7, the message is transferred to a timestamp setting module for processing, the timestamp setting module adds a timestamp in the message and returns the timestamp to the switch, and meanwhile, the message sending module sets a reserved field of the received PTP event message to 0 and then transfers the PTP event message to the PHY;
If the reserved is '6', setting reserved as '0', acquiring time from a time stamp generating module, updating time information in the PTP message, and forwarding to the PHY;
if reserved is '5', reserved is set to '0', and then the reserved is forwarded to PHY.
For PHY processing, the PHY transmits the received FPGA message to the network side.
When the CPU receives the FPGA transmission packet, the PTP protocol stack (PTP protocol stack packet receiving processing module) in the CPU receives the packet, in which case, first the PHY forwards the packet sent from the network side to the FPGA, referring to fig. 1.
And then, after the message receiving module in the FPGA receives the PTP message sent by the PHY, the PTP message is directly analyzed, and whether the message is a general message or an event message is distinguished. If PTP GENERAL messages are received, the message receiving module directly sends the messages to the switch, and the messages reach the CPU through the switch; if the PTP event message is received, the message receiving module sends the event message to the time stamp setting module, and the time stamp setting module obtains time from the time stamp generating module, adds the time stamp at the tail part of the event message, and modifies CRC at the tail part of the ETH frame.
After the switch receives the message sent by the message receiving module, the CPU rule on the switch port is configured as a PTP message, and the PTP message is copied to the CPU and discarded.
Referring to fig. 4, after the CPU receives the PTP message sent by the FPGA, the timestamp analysis module analyzes the message, and if the received general message is a general message, the processing is performed according to the PTP protocol; if the CPU receives the PTP event message, analyzing the time stamp of the TLV format of the message Wen Weibu, judging whether the reserved field is equal to 7, if so, the message is the PTP event message transmitted back to the CPU (namely, the message transmitted back after the CPU transmits to the FPGA and the FPGA increases the time stamp), thereby recording the transmission time stamp of the corresponding PTP event message; if the judgment result is no, the CPU receives the PTP event message sent by the network side and directly processes the PTP event message normally according to the PTP protocol.
The timestamp data structure definition of this embodiment is shown in table 1:
TABLE 1
Wherein dataType is a data type, where a fixed "1" indicates a time stamp; dataLen is the data length, where the data length is fixed to 12 bytes; reserved is a reserved field; secondsFieldHigh is time 'second' 16 bits high; secondsFieldLow is the time's' low 32 bits; nanoSecondsField is the time 'nanosecond'.
In summary, according to the PTP message processing method provided by the application, the time stamp is added to the messages sent by the CPU through the time stamp setting module, so that each PTP event message carries its own time stamp, and even if a large number of messages need to be processed, the PTP protocol stack of the CPU is not processed, the erroneous time stamp data cannot be taken, thereby solving the problem of larger error of the PTP calculation result and ensuring the accuracy of the synchronization of the messages. In addition, for the CPU to send PTP event message, the FPGA increases the time stamp after receiving and transmits the time stamp back to the CPU, then the event message Wen Beifen is stored in the CPU, namely, after the exchange chip receives the PTP message, the time stamp can be analyzed and recorded, thereby saving hardware resources such as RAM/FIFO and the like. In addition, the PTP message processing method is suitable for any network such as SPN, OTN, PTN, IPRAN, PON, so that the application range of the scheme of the application is wider.
It should be noted that, the PTP message processing method provided in this embodiment is used to implement the foregoing embodiment, and the description is omitted.
In a third aspect, an embodiment of the present application provides an electronic device, including the PTP packet processing system described in any of the above embodiments.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (10)

1. The PTP message processing system is characterized by comprising a logic unit and a control unit, wherein the logic unit comprises a message receiving module, a message sending module, a time stamp generating module and a time stamp setting module; wherein,
The control unit assembles the PTP message according to the message type and a preset rule and sends the PTP message to the logic unit, or analyzes the received PTP message to obtain a time stamp and records the time stamp;
The message sending module receives and analyzes the PTP message sent by the control unit, and determines whether to send the PTP message to the time stamp setting module according to the analysis result;
The message receiving module receives and analyzes the PTP message of the network side, and determines whether to send the PTP message to the time stamp setting module according to the analysis result;
the time stamp generating module generates a time stamp according to the receiving time or the sending time of the PTP message;
and the time stamp setting module fills the time stamp into the PTP message and sends the PTP message to the control unit.
2. The system of claim 1, wherein the control unit includes a PTP protocol stack packet processing module, and wherein the control unit assembles a PTP message according to a message type and a preset rule, including:
the PTP protocol stack packet sending processing module generates a PTP message according to a PTP protocol, a message to be assembled, a message type and a preset rule;
wherein, the preset rule comprises:
if the message to be assembled is a general message, setting a reserved field of the PTP protocol as a first preset value;
if the message to be assembled is an event message and the message type is a one-step synchronous message, setting a reserved field of the PTP protocol as a second preset value;
If the message to be assembled is an event message and the message type is not a one-step synchronous message, the reserved field of the PTP protocol is set to a third preset value.
3. The system according to claim 2, wherein the control unit includes a PTP protocol stack packet receiving processing module and a timestamp parsing module, and the parsing the received PTP packet to obtain a timestamp and record the timestamp includes:
The PTP protocol stack packet receiving processing module receives the PTP message sent by the time stamp setting module and forwards the PTP message to the time stamp analyzing module;
the time stamp analysis module judges whether the PTP message is an event message, and if the PTP message is not the event message, the PTP message is processed according to a corresponding PTP protocol;
if the event message is the event message, carrying out format analysis on the time information of the PTP message to obtain a time stamp, and judging whether a reserved field in the PTP message is a third preset value or not;
If the judgment result is yes, recording the sending time stamp of the PTP message; if the judgment result is "no", recording the receiving time stamp of the PTP message, and processing the PTP message according to the corresponding PTP protocol.
4. The system according to claim 2, wherein the message transmitting module receives and parses the PTP message transmitted by the control unit, and determines whether to transmit the PTP message to the time stamp setting module according to the parsing result, including:
the message sending module judges the value of a reserved field in the PTP message;
If the reserved field in the PTP message is a third preset value, copying the PTP message and sending the PTP message to a time stamp setting module, and meanwhile, setting the reserved field of the PTP message to a fourth preset value by the message sending module and forwarding the fourth preset value to a network side;
If the reserved field in the PTP message is a second preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value, and forwards the PTP message to a network side after adding a time stamp;
If the reserved field in the PTP message is a first preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value and forwards the fourth preset value to the network side.
5. The system according to claim 2, wherein the message receiving module receives and parses the PTP message at the network side, and determines whether to send the PTP message to the time stamp setting module according to the parsing result, including:
The message receiving module analyzes the PTP message and analyzes whether the PTP message is an event message;
If the PTP message is not an event message, the message receiving module forwards the PTP message to the control unit;
And if the PTP message is an event message, transmitting the PTP message to the timestamp setting module.
6. The system of claim 1, wherein the timestamp setting module populates the timestamp into a PTP message and sends the PTP message to a control unit, comprising:
The time stamp setting module acquires the time stamp from the time stamp generating module and converts the time stamp into a TLV format;
And writing the time stamp in the TLV format into the tail part of the PTP message.
7. The system of claim 1, wherein the PTP message processing system further comprises a switch chip for implementing data interaction between the logic unit and the control unit, and a PHY for implementing data interaction between the logic unit and the network side.
8. The PTP message processing method is characterized by being applied to a PTP message processing system comprising a logic unit and a control unit, wherein the logic unit comprises a message receiving module, a message sending module, a time stamp generating module and a time stamp setting module;
When the control unit sends a message to the logic unit, the method comprises the following steps:
The control unit assembles a PTP message according to the message type and a preset rule, and sends the assembled PTP message to the message sending module; wherein, the preset rule comprises: if the message to be assembled is a general message, setting a reserved field of the PTP protocol as a first preset value; if the message to be assembled is an event message and the message type is a one-step synchronous message, setting a reserved field of the PTP protocol as a second preset value; if the message to be assembled is an event message and the message type is not a one-step synchronous message, setting a reserved field of the PTP protocol as a third preset value;
The message sending module judges the value of the reserved field in the PTP message, if the reserved field in the PTP message is a third preset value, the PTP message is copied and sent to the time stamp setting module, and meanwhile, the message sending module sets the reserved field of the PTP message to a fourth preset value and forwards the fourth preset value to the network side; if the reserved field in the PTP message is a second preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value, and forwards the PTP message to a network side after adding a time stamp in the PTP message; if the reserved field in the PTP message is a first preset value, the message sending module sets the reserved field of the PTP message to a fourth preset value and forwards the fourth preset value to the network side.
9. The method of claim 8, wherein when the control unit receives a message sent by the logic unit, the method comprises:
the message receiving module receives and analyzes the PTP message at the network side and judges whether the PTP message is an event message or not; if the PTP message is not an event message, the message receiving module forwards the PTP message to the control unit; if the PTP message is an event message, the PTP message is sent to the time stamp setting module, and the time stamp setting module fills the time stamp into the PTP message and forwards the PTP message to the control unit;
The control unit analyzes the received PTP message to obtain a time stamp and records the time stamp; analyzing whether the PTP message is an event message, if not, processing the PTP message according to a corresponding PTP protocol; if the event message is the event message, carrying out format analysis on the time information of the PTP message to obtain a time stamp, and judging whether a reserved field in the PTP message is a third preset value or not; if the judgment result is yes, recording the sending time stamp of the PTP message; if the judgment result is no, recording the receiving time stamp of the PTP message, and processing the PTP message according to the corresponding PTP protocol.
10. An electronic device comprising the PTP message processing system of any of claims 1-6.
CN202311792000.5A 2023-12-22 2023-12-22 PTP message processing system, method and electronic equipment Pending CN117938292A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311792000.5A CN117938292A (en) 2023-12-22 2023-12-22 PTP message processing system, method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311792000.5A CN117938292A (en) 2023-12-22 2023-12-22 PTP message processing system, method and electronic equipment

Publications (1)

Publication Number Publication Date
CN117938292A true CN117938292A (en) 2024-04-26

Family

ID=90749761

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311792000.5A Pending CN117938292A (en) 2023-12-22 2023-12-22 PTP message processing system, method and electronic equipment

Country Status (1)

Country Link
CN (1) CN117938292A (en)

Similar Documents

Publication Publication Date Title
US8392631B1 (en) Methods and apparatus for transmitting data streams via a heterogeneous network
JP4051070B2 (en) Data frame configuration method, data processing method, and Ethernet device in synchronized Ethernet
CN111565073B (en) Wireless optical difference synchronization method and system based on 5G communication and 5G communication module
CA2493383A1 (en) Apparatus and method for a virtual hierarchial local area network
US8862719B2 (en) Data transmission/reception apparatus and method for inserting and extracting maintenance management data
CN113765857A (en) Message forwarding method, device, equipment and storage medium
CN108521343A (en) A kind of processing method and processing device of OAM message
US6741566B1 (en) Remote management ethernet network and device
WO2021073377A1 (en) Multicast stream detection method, device and system
WO2017193732A1 (en) Method for encapsulating and decapsulating pseudo-wire data message, and relevant apparatus
US20230370899A1 (en) Packet forwarding method, packet processing method, and device
JP2005012381A (en) Device and method for transferring data, data communication system using the same and program
WO2021233313A1 (en) Port state configuration method, apparatus, system, and storage medium
CN113890680A (en) Transmission method applied to fiber channel avionics network DDS
US11750310B2 (en) Clock synchronization packet exchanging method and apparatus
CN117938292A (en) PTP message processing system, method and electronic equipment
WO2019134607A1 (en) Information processing method and device, communication apparatus, and computer readable storage medium
EP2434699A1 (en) Method and apparatus for transmitting and processing extended remote defection identification message and extended backward defection identification message
CN109150350B (en) Equipment delay compensation method, system and storage medium
JP3605005B2 (en) System and method for selectively separating point-to-point protocol header information
WO2023231428A1 (en) Ipv4 packet encapsulation method, electronic device, and computer storage medium
WO2021073570A1 (en) Communication method, apparatus and system
CN114158067B (en) Method and device for data transmission in private network
EP4236121A1 (en) Network synchronization method and apparatus, and device, system and readable storage medium
WO2022222693A1 (en) Message processing method and apparatus, electronic device, and computer-readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination