CN112887045B - Message transmission method and device, FPGA (field programmable Gate array) and electronic equipment - Google Patents
Message transmission method and device, FPGA (field programmable Gate array) and electronic equipment Download PDFInfo
- Publication number
- CN112887045B CN112887045B CN201911205112.XA CN201911205112A CN112887045B CN 112887045 B CN112887045 B CN 112887045B CN 201911205112 A CN201911205112 A CN 201911205112A CN 112887045 B CN112887045 B CN 112887045B
- Authority
- CN
- China
- Prior art keywords
- message
- segment
- target
- timestamp
- data frame
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
- H04J3/0635—Clock or time synchronisation in a network
- H04J3/0638—Clock or time synchronisation among nodes; Internode synchronisation
- H04J3/0658—Clock or time synchronisation among packet nodes
- H04J3/0661—Clock or time synchronisation among packet nodes using timestamps
- H04J3/0667—Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Communication Control (AREA)
Abstract
The embodiment of the application provides a message transmission method and device, an FPGA (field programmable gate array) and electronic equipment, and the method comprises the steps of obtaining a first message with a front end serving as a control information section and a rear end serving as a target message section, wherein the control information section comprises a data frame indication identifier and a timestamp transmission mode identifier of the target message section; stripping the control information segment of the first message to obtain a control information segment and a target message segment; determining the type of the target message segment according to the data frame indication mark in the control information segment; when the type of the target message segment is an event message, generating a timestamp of the target message segment; determining a transfer mode of the target message segment according to the timestamp transfer mode identification; when the transmission mode of the target message section is one-step, adding the timestamp of the target message section into the target message section; the target segment is sent including the timestamp. The timestamp of the message is stamped by analyzing the control information segment in the message, the realization and control mode is simple, and the system resource can be saved.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for message transmission, an FPGA, and an electronic device.
Background
The IEEE 1588 standard is a precision clock synchronization Protocol (PTP) for short, which is a fully-known network measurement and control system, and uses hardware and software to cooperate with each other, thereby obtaining more Precise timing synchronization. In the PTP system, the PTP master and the PTP slave are comprised, and a request response mechanism is adopted between the PTP master and the PTP slave to measure the transmission delay.
In the related PTP technology, in the process of sending the PTP message, the timestamp stamping module can decapsulate the packaged PTP message and analyze the decapsulated PTP message, so as to determine whether to generate the timestamp of the PTP message and repackage the PTP message. However, decapsulating and repackaging PTP messages consumes system resources.
Disclosure of Invention
An object of the embodiments of the present application is to provide a message transmission method and apparatus, a field programmable gate array, and an electronic device, so as to reduce consumption of system resources. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a packet transmission method, where the method includes:
acquiring a first message of which the front end is a control information segment and the rear end is a target message segment, wherein the control information segment comprises a data frame indication identifier and a timestamp transmission mode identifier of the target message segment;
stripping a control information segment of the first message to obtain the control information segment and the target message segment;
determining the type of the target message segment according to the data frame indication mark in the control information segment;
when the type of the target message segment is an event message, generating a timestamp of the target message segment;
determining the delivery mode of the target message segment according to the timestamp delivery mode identification;
when the transmission mode of the target message segment is one-step transmission, adding the time stamp of the target message segment into the target message segment;
transmitting the target segment including the timestamp.
In one possible embodiment, after determining the delivery mode of the target segment according to the timestamp delivery mode identification, the method further includes:
when the transfer mode is two-step transfer two-step, sending the target message segment;
generating a target general message according to the data frame indication mark, wherein the target general message comprises a timestamp of the target message segment;
and sending the target general message.
In a possible implementation manner, before the obtaining a target packet whose front end is a control information segment and whose back end is a target packet segment, the method further includes:
acquiring a data frame indication, a timestamp transmission mode, a data frame sequence number and a timestamp of a second message;
and generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode, the data frame sequence number and the timestamp of the second message to obtain the first message.
In a possible implementation manner, before the obtaining a target packet whose front end is a control information segment and whose back end is a target packet segment, the method further includes:
acquiring a data frame indication, a timestamp transmission mode and a data frame serial number of a first message to be generated;
and generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode and the data frame sequence number of the first message to be generated to obtain the first message.
In a possible implementation manner, the message transmission method is implemented by a field programmable gate array FPGA.
In a second aspect, an embodiment of the present application provides a packet transmission apparatus, where the apparatus includes:
the message acquisition module is used for acquiring a first message of which the front end is a control information section and the rear end is a target message section, wherein the control information section comprises a data frame indication identifier and a timestamp transmission mode identifier of the target message section;
the control information stripping module is used for stripping a control information segment of the first message to obtain the control information segment and the target message segment;
the message type judging module is used for determining the type of the target message segment according to the data frame indication mark in the control information segment;
the timestamp generation module is used for generating a timestamp of the target message segment when the type of the target message segment is an event message;
a delivery mode determining module, configured to determine a delivery mode of the target segment according to the timestamp delivery mode identifier;
a message sending module, configured to add a timestamp of the target segment to the target segment when the delivery manner of the target segment is one-step delivery; transmitting the target segment including the timestamp.
In a possible implementation manner, the message sending module is further configured to: when the transfer mode is two-step transfer two-step, sending the target message segment; generating a target general message according to the serial number identifier of the data frame, wherein the target general message comprises a timestamp of the target message segment; and sending the target general message.
In a possible embodiment, the apparatus further comprises:
the information acquisition module is used for acquiring a data frame indication, a timestamp transmission mode, a data frame serial number and a timestamp of the second message;
and the message generation module is used for generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode, the data frame sequence number and the timestamp of the second message to obtain the first message.
In a possible embodiment, the apparatus further comprises:
the information acquisition module is used for acquiring a data frame indication, a timestamp transmission mode and a data frame serial number of a first message to be generated;
and the message generation module is used for generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode and the data frame sequence number of the first message to be generated to obtain the first message.
In a possible implementation manner, the message transmission apparatus is implemented based on an FPGA.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to implement any of the above-described message transmission methods when executing the program stored in the memory.
In a fourth aspect, an embodiment of the present application provides a field programmable gate array, where the field programmable gate array implements any of the above message transmission methods during operation.
According to the message transmission method and device, the field programmable gate array and the electronic device, a first message with a front end serving as a control information section and a rear end serving as a target message section is obtained, wherein the control information section comprises a data frame indication identifier and a timestamp transmission mode identifier of the target message section; stripping the control information segment of the first message to obtain a control information segment and a target message segment; determining the type of the target message segment according to the data frame indication mark in the control information segment; when the type of the target message segment is an event message, generating a timestamp of the target message segment; determining a transfer mode of the target message segment according to the timestamp transfer mode identification; when the transmission mode of the target message section is one-step transmission, adding the time stamp of the target message section into the target message section; the target segment is sent including the timestamp. Compared with a decapsulated message, the method analyzes the content of the message to determine whether to stamp, directly completes the stamping of the message timestamp through the analysis of the control information segment in the message, omits the process of decapsulating the message, is simple in stamping implementation and control mode, can save system resources, and can accelerate the processing speed of the message. Meanwhile, the control information segment is not sent after being stripped, and can support the communication with the existing PTP equipment, so that the application range is wide. Of course, it is not necessary for any product or method of the present application to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a first schematic diagram of a message transmission method according to an embodiment of the present application;
fig. 2 is a second schematic diagram of a message transmission method according to an embodiment of the present application;
fig. 3 is a third schematic diagram of a message transmission method according to an embodiment of the present application;
fig. 4 is a schematic diagram of a message transmission system according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an FPGA mounting location according to an embodiment of the present application;
fig. 6 is a fourth schematic diagram of a message transmission method according to an embodiment of the present application;
fig. 7 is a schematic diagram of a message transmission apparatus according to an embodiment of the present application;
fig. 8 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
First, terms in the embodiments of the present application are explained.
IEEE 1588: the IEEE 1588 standard is called a precision clock synchronization Protocol (precision Time Protocol) of a network measurement and control system.
PTP message: the event messages include sync, delay _ req and the like, and the common messages include follow _ up, delay _ resp and the like.
PTP-master: the time service master device defined in the application is abbreviated.
PTP-slave: the slave device defined by the application and needing to be synchronized with the master device is short for name.
A request response mechanism: a transmission delay measurement mechanism defined in IEEE 1588. Recording timestamps of the event messages sync and the delay _ req when the messages enter and exit the mac, and measuring the transmission delay and the travel time deviation between the PTP-master and the PTP-slave by using the timestamps transmitted by the follow _ up and delay-resp messages.
One-step, two-step: the IEEE 1588 protocol defines a mode for transmitting a timestamp, wherein a sending timestamp t1 of a sync message in a Two-step mode is carried by a follow _ up message, and a One-step mode is carried by the sync message.
In the related art, when the transmission timestamp of the message is determined, the message is decapsulated by a timestamp module after the message is generated, and the decapsulated message is analyzed, so as to determine whether to generate the timestamp of the message, and then the message is encapsulated again and transmitted. However, in the process of decapsulating and encapsulating the packet, decapsulating and encapsulating each packet causes a waste of system performance, and the implementation and control method is complicated.
In view of this, an embodiment of the present application provides a message transmission method, and referring to fig. 1, the method includes:
s101, a first message with a front end as a control information segment and a rear end as a target message segment is obtained, wherein the control information segment comprises a data frame indication mark and a timestamp transmission mode mark of the target message segment.
The message transmission method of the embodiment of the application can be realized through the message sending equipment. Specifically, the message transmission method of the embodiment of the present application may be applied to a PTP protocol, and in a PTP system, the message sending device may include a PTP-master and a PTP-slave.
The message sending equipment acquires a first message to be sent, wherein the first message is any message to be sent. The first message consists of two parts, wherein the front end is a control information segment, and the rear end is a target message segment, wherein the target message segment is a packaged message to be sent. The control information segment includes a data frame indication identifier and a timestamp transmission mode identifier of the target message segment, where the data frame indication identifier is used to represent a type of the target message segment, specifically, the type of the target message segment may include an event message and a general message, the event message may include sync, delay _ req, and the like, and the general message may include follow _ up and delay _ resp, and the like; the timestamp transmission mode identifies a transmission mode of a timestamp used for representing the target segment, and specifically, the transmission mode of the timestamp may include One-step, two-step, and the like. In a possible implementation manner, the control information segment may further include a data frame sequence number identifier of the target segment, where the data frame sequence number identifier is used to uniquely characterize the data frame sequence number of the target segment.
The first message is generated by the message sending equipment. Optionally, before obtaining the target packet with the front end being the control information segment and the back end being the target packet segment, the method further includes:
step one, acquiring a data frame indication, a timestamp transmission mode and a data frame sequence number of a first message to be generated.
When the first message is an event message, the message sending equipment acquires a data frame indication, a timestamp transmission mode and a data frame serial number of the first message to be generated.
And step two, generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode and the data frame sequence number of the first message to be generated, and obtaining the first message.
In the related art, when an event message is generated, corresponding message information is generated and encapsulated according to a data frame indication, a timestamp transmission mode and a data frame serial number of the message to be generated, so that the message to be transmitted is obtained. In this embodiment, after the message sending device generates a message to be sent (target message segment), a control information segment needs to be added before the target message segment, so as to obtain a first message including the control information segment and the target message segment, where the control information segment is determined according to a data frame indication, a timestamp transmission mode, and a data frame sequence number of the first message to be generated.
For example, when the target message segment is a sync message, after the sync message (encapsulation state) is generated according to the rules of PTP, a control information segment is added in front of the sync message according to the data frame indication, the timestamp transmission mode, and the data frame sequence number of the sync message, thereby obtaining a first message; or when the target message segment is a delay _ req message, after the delay _ req message is generated (in a packaged state) according to the provisions of PTP, adding a control information segment before the delay _ req message according to a data frame indication, a timestamp transmission mode, and a data frame sequence number of the delay _ req message, thereby obtaining the first message.
Optionally, before obtaining the target packet with the front end being the control information segment and the back end being the target packet segment, the method further includes:
step one, acquiring a data frame indication, a timestamp transmission mode, a data frame sequence number and a timestamp of a second message.
When the first message is a general message, the second message is an event message, and the second message may be generated locally by the current message sending device or sent by other message sending devices. For example, in the message transmission method according to the embodiment of the present application, if the current message sending device is a PTP-master and the second message is a sync, the first message is a follow _ up; and if the second message is delay _ req, the first message is delay-resp.
And step two, generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode, the data frame sequence number and the timestamp of the second message to obtain the first message.
In the related art, when a general message is generated, message data generated according to a data frame indication, a timestamp transmission mode, a data frame sequence number, and a timestamp of a message (a second message) corresponding to the general message is encapsulated to obtain a message to be sent. In this embodiment, after the message sending device generates a message to be sent (target message segment), a control information segment needs to be added before the target message segment, so as to obtain a first message including the control information segment and the target message segment, where the control information segment is determined according to a data frame indication, a timestamp transmission mode, and a data frame sequence number of a second message to be generated.
In a possible embodiment, the generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode, the data frame sequence number, and the timestamp of the second message to obtain the first message includes: obtaining the data frame indication, the timestamp transmission mode and the data frame sequence number of the first message according to the data frame indication, the timestamp transmission mode and the data frame sequence number of the second message; and generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode, the data frame sequence number and the timestamp of the second message of the first message to obtain the first message.
For example, in the two-step method, when the second message is sync, after a follow _ up message (encapsulation state) is generated according to the rules of PTP, a control information segment is added in front of the follow _ up message according to the data frame indication, the timestamp transmission method, and the data frame sequence number of the sync message/follow _ up message, thereby obtaining a first message; or when the second message is a delay _ req message, after generating a delay-resp message (in a packaged state) according to the provisions of PTP, adding a control information segment before the delay-resp message according to the data frame indication, the timestamp transmission mode, and the data frame sequence number of the delay _ req message/the delay-resp message, thereby obtaining the first message.
S102, stripping the control information segment of the first message to obtain the control information segment and the target message segment.
The message sending equipment peels the control information segment in the first message to obtain the control information segment after peeling and a target message segment to be sent.
S103, determining the type of the target message segment according to the data frame indication mark in the control information segment.
The message sending device analyzes the control information segment of the first message, determines the type of the target message segment according to the data frame indication identifier, wherein the type of the target message segment includes an event message and a general message, and specifically, for PTP, the type of the target message segment includes sync, delay _ req, follow _ up, and delay _ resp.
And S104, generating the time stamp of the target message section when the type of the target message section is the event message.
When the message sending equipment judges that the type of the target message segment is the event message, the effective signal of the timestamp is enabled, the timestamp of the target message segment is generated, and therefore the sending timestamp of the message is obtained.
And S105, determining the delivery mode of the target message segment according to the timestamp delivery mode identification.
And the message sending equipment determines whether the transfer mode of the target message segment is one-step or two-step according to the timestamp transfer mode identification.
And S106, adding the time stamp of the target message segment into the target message segment when the transmission mode of the target message segment is one-step transmission.
In the one-step mode, the sync message needs to carry the timestamp of the sync message, so the timestamp of the target message segment is added to the target message segment.
S107, the target segment including the time stamp is sent.
And the message sending equipment sends the target message segment added with the timestamp. Specifically, a schematic diagram of generating and sending the first message may be as shown in fig. 2, where the PTP message is the target message segment.
Compared with the prior art that the message is unpackaged, the content of the message is analyzed to determine whether to stamp, in the embodiment of the application, the stamping of the message timestamp is completed directly through analyzing the control information section in the message, the stamping implementation and the control mode are simple, system resources can be saved, and the processing speed of the message can be accelerated. Meanwhile, the control information segment is not sent after being stripped, and can support the communication with the existing PTP equipment, so that the application range is wide.
In a possible embodiment, referring to fig. 3, after determining the delivery method of the target segment according to the timestamp delivery method identifier, the method further includes:
s108, when the transmission mode is two-step, the target segment is sent.
When the transfer mode is two-step, the target message segment is directly sent.
S109, generating a target general message according to the data frame indication mark of the target message segment, wherein the target general message comprises the timestamp of the target message segment.
The data frame indicator is used to characterize the type of the target segment, for example, when the type of the target segment is sync, the type of the target general message is follow _ up.
The target general message may also include two parts, namely a control information segment and a message segment, the control information segment may include a data frame indication identifier and a timestamp transmission mode identifier of the target general message, and the message segment of the target general message includes a timestamp of the target message segment. The data frame indication mark is used for representing the type of the target general message, and the timestamp transmission mode mark represents that the transmission mode is two-step. In a possible embodiment, the control information segment of the target generic packet may further include a data frame sequence number identifier or the like.
S110, the target general message is sent.
Specifically, in the sending process of the target general message, the control information segment of the target general message is stripped, so as to obtain the control information segment and the message segment of the target general message.
The data frame indicator in the control information segment of the target general packet represents that the target general packet is a general packet, and may specifically be a follow _ up packet, so that the packet segment of the target general packet is sent, where the packet segment of the target general packet includes a timestamp of the target packet segment.
Compared with the prior art that the message is unpackaged, the content of the message is analyzed to determine whether to stamp, in the embodiment of the application, the stamping of the message timestamp is completed directly through analyzing the control information section in the message, the stamping implementation and the control mode are simple, system resources can be saved, and the processing speed of the message can be accelerated. Meanwhile, the control information segment is not sent after being stripped, and can support the communication with the existing PTP equipment, so that the application range is wide.
Optionally, after determining the type of the target segment according to the data frame indicator in the control information segment, the method further includes:
and when the type of the target message segment is a general message, sending the target message segment.
The general message information does not need to be stamped, when the type of the target message segment is a general message, the message sending equipment directly sends the target message segment, wherein the control information segment is latched in the message sending equipment and cannot be sent together with the target message segment.
Compared with the related art of decapsulating a message, the method and the device for determining the type of the target message segment in the embodiment of the application analyze the content of the message and determine whether to stamp the message, and directly send the target message segment when the type of the target message segment is a general message, without decapsulating the message, and the method for realizing and controlling the stamp is simple, so that system resources can be saved, and the processing speed of the message can be increased.
Optionally, the message transmission method is implemented by an FPGA (Field-Programmable Gate Array).
For example, in a PTP system, one PTP-master may mount multiple PTP-masters. In the related art, the PTP function is generally realized by a mode of CPU + FPGA or FPGA + soft core, and when the number of PTP-slave in the system increases, the CPU or soft core of the PTP-master needs frequent response interrupt to process PTP messages when the number of PTP-slave in the system increases, so that the number of ways to mount PTP-slave is significantly limited. In the embodiment of the application, the PTP function is directly realized through the FPGA, the processing speed of the PTP message can be increased by using the FPGA, and the quantity of PTP-slave which can be mounted by the PTP-master is increased.
By using the FPGA as a message transceiving timestamp recording module, the closer the position of the recording timestamp is to the PHY (Port Physical Layer), the more accurate the timestamp is. Specifically, referring to fig. 5, the function of recording the timestamp of the FPGA may be set between the buffer and the MAC (Media Access Control) layer, the receiving and sending directions are independent, and the timestamp recording modes are the same. The buffer here may be specifically a FIFO (First Input First Output, first in First out) memory or the like. Recording the effective time of the first byte of the received and sent message, because the transmission delay of the MAC is fixed, compensating the recording time to obtain the accurate message receiving and sending timestamp, and finally judging the effectiveness of the timestamp according to the characteristic information of the received and sent message.
As shown in fig. 6, the message transmission method according to the embodiment of the present application may further include:
one device is selected as a PTP-master, the other devices are used as PTP-slave, and the PTP-master and the PTP-slave can communicate with each other through a switch network, for example, as shown in fig. 4.
The PTP-master operation flow comprises the following steps:
step one, configuring a PTP-master clock domain number and starting PTP enabling, and operating the message transmission method of the embodiment of the application.
And step two, constructing a sync message and a follow-up message according to a PTP format, and sending the sync message and the follow-up message to all PTP-slave equipment through a switching network, wherein the follow-up message accurately carries a timestamp of the sending time of the sync message.
And step three, receiving and analyzing the network message, constructing and sending a delay-resp message after confirming that the delay-req message is received, wherein the delay-resp message accurately carries a time stamp of the receiving time of the delay-req message.
The PTP-slave operation flow comprises the following steps:
step one, configuring PTP-slave clock domain numbers, analyzing PTP messages sent by a PTP-master according to rules matched with clock domains, and constructing and sending delay _ req messages when confirming that follow _ up messages are received.
And step two, recording a sync message receiving time stamp T2 and a delay _ req message sending time stamp T3. And extracting a timestamp T1 carried by the follow _ up message and a timestamp T4 carried by the dleay _ resp message.
And step three, at the time of finishing the T4 extraction, if the group of timestamps is invalid, discarding the group of timestamps, and avoiding the timestamp from being spread by mistake.
For example, when a certain packet is lost or a network line is disconnected due to an abnormal network link, the sequence numbers of the PTP packets are analyzed to be different, and the current group of timestamps is invalid when the sequence numbers of the PTP packets are different, so that the current timestamp cannot be used, and the timestamp is prevented from being spread by mistake.
And step four, processing the time stamps from T1 to T4, calculating corresponding master-slave one-way delay (delay) and travel time deviation (offset), and adjusting the clock oscillator.
An embodiment of the present application further provides a packet transmission apparatus, referring to fig. 7, where the apparatus includes:
a message obtaining module 901, configured to obtain a first message whose front end is a control information segment and whose rear end is a target message segment, where the control information segment includes a data frame indication identifier and a timestamp transmission mode identifier of the target message segment;
a control information stripping module 902, configured to strip the control information segment of the first message to obtain the control information segment and the target message segment;
a message type determining module 903, configured to determine the type of the target message segment according to the data frame indicator in the control information segment;
a timestamp generating module 904, configured to generate a timestamp of the target segment when the type of the target segment is an event message;
a delivery mode determining module 905, configured to determine a delivery mode of the target segment according to the timestamp delivery mode identifier;
a message sending module 906, configured to add a timestamp of the target segment to the target segment when the delivery manner of the target segment is one-step delivery; transmitting the target segment including the timestamp.
Optionally, the packet sending module 907 is further configured to: when the transfer mode is two-step transfer two-step, sending the target message segment; generating a target general message according to the serial number identifier of the data frame, wherein the target general message comprises a timestamp of the target message segment; and sending the target general message.
Optionally, the message transmission apparatus according to this embodiment of the present application further includes:
the information acquisition module is used for acquiring a data frame indication, a timestamp transmission mode, a data frame serial number and a timestamp of the second message;
and the message generation module is used for generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode, the data frame serial number and the timestamp of the second message to obtain the first message.
Optionally, the message transmission apparatus according to this embodiment of the present application further includes:
the information acquisition module is used for acquiring a data frame indication, a timestamp transmission mode and a data frame serial number of a first message to be generated;
and the message generation module is used for generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode and the data frame sequence number of the first message to be generated to obtain the first message.
The embodiment of the application also provides an electronic device, which comprises a processor and a memory;
the memory is used for storing computer programs;
the processor is configured to implement any of the message transmission methods when executing the program stored in the memory.
Optionally, as shown in fig. 8, the electronic device according to the embodiment of the present application further includes: a communication interface 1002 and a communication bus 1004, wherein the processor 1001, the communication interface 1002 and the memory 1003 communicate with each other via the communication bus 1004.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
The embodiment of the application also provides a field programmable gate array, and the field programmable gate array realizes any message transmission method during operation.
It should be noted that, in this document, the technical features in the various alternatives can be combined to form the scheme as long as the technical features are not contradictory, and the scheme is within the scope of the disclosure of the present application. Relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on differences from other embodiments. In particular, for the embodiments of the apparatus, the electronic device, and the storage medium, since they are substantially similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims (7)
1. A method for packet transmission, the method comprising:
acquiring a first message of which the front end is a control information segment and the rear end is a target message segment, wherein the control information segment comprises a data frame indication identifier and a timestamp transmission mode identifier of the target message segment; the timestamp delivery mode identifies a delivery mode of a timestamp used to characterize the target segment;
stripping a control information segment of the first message to obtain the control information segment and the target message segment;
determining the type of the target message segment according to the data frame indication mark in the control information segment;
when the type of the target message segment is an event message, generating a timestamp of the target message segment;
determining the delivery mode of the target message segment according to the timestamp delivery mode identification;
when the transmission mode of the target message segment is one-step transmission, adding the time stamp of the target message segment into the target message segment;
transmitting a target segment including the timestamp;
before the obtaining of the first message with the front end being the control information segment and the back end being the target message segment, the method further includes:
acquiring a data frame indication, a timestamp transmission mode, a data frame sequence number and a timestamp of a second message; generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode, the data frame serial number and the timestamp of the second message to obtain the first message, wherein the control information segment is determined according to the data frame indication, the timestamp transmission mode and the data frame serial number of the second message to be generated; when the first message is a general message, the second message is an event message; or
Acquiring a data frame indication, a timestamp transmission mode and a data frame sequence number of a first message to be generated; and generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode and the data frame sequence number of the first message to be generated to obtain the first message, wherein the control information segment is determined according to the data frame indication, the timestamp transmission mode and the data frame sequence number of the first message to be generated.
2. The method of claim 1, wherein after determining the delivery of the target segment according to the timestamp delivery identification, the method further comprises:
when the transfer mode is two-step transfer two-step, sending the target message segment;
generating a target general message according to the data frame indication mark, wherein the target general message comprises a timestamp of the target message segment;
and sending the target general message.
3. The method according to claim 1 or 2, characterized in that the message transmission method is implemented by a field programmable gate array FPGA.
4. A message transmission apparatus, the apparatus comprising:
the message acquisition module is used for acquiring a first message of which the front end is a control information section and the rear end is a target message section, wherein the control information section comprises a data frame indication identifier and a timestamp transmission mode identifier of the target message section; the timestamp delivery mode identifies a delivery mode of a timestamp used to characterize the target segment;
the control information stripping module is used for stripping a control information segment of the first message to obtain the control information segment and the target message segment;
the message type judging module is used for determining the type of the target message segment according to the data frame indication mark in the control information segment;
the timestamp generation module is used for generating a timestamp of the target message segment when the type of the target message segment is an event message;
a delivery mode determining module, configured to determine a delivery mode of the target segment according to the timestamp delivery mode identifier;
a message sending module, configured to add a timestamp of the target segment to the target segment when the delivery manner of the target segment is one-step delivery; sending a target segment including the timestamp;
the information acquisition module is used for acquiring a data frame indication, a timestamp transmission mode, a data frame serial number and a timestamp of the second message; a message generating module, configured to generate a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode, the data frame sequence number, and the timestamp of the second message, to obtain the first message, where the control information segment is determined according to the data frame indication, the timestamp transmission mode, and the data frame sequence number of the second message to be generated; or
The information acquisition module is used for acquiring a data frame indication, a timestamp transmission mode and a data frame serial number of a first message to be generated; and the message generation module is used for generating a control information segment and a target message segment of the first message according to the data frame indication, the timestamp transmission mode and the data frame sequence number of the first message to be generated to obtain the first message, wherein the control information segment is determined according to the data frame indication, the timestamp transmission mode and the data frame sequence number of the first message to be generated.
5. The apparatus of claim 4, wherein the messaging module is further configured to: when the transfer mode is two-step transfer two-step, sending the target message segment; generating a target general message according to the data frame indication mark, wherein the target general message comprises a timestamp of the target message segment; and sending the target general message.
6. The apparatus according to claim 4 or 5, wherein the message transmission means is implemented based on an FPGA.
7. An electronic device comprising a processor and a memory;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 1-3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911205112.XA CN112887045B (en) | 2019-11-29 | 2019-11-29 | Message transmission method and device, FPGA (field programmable Gate array) and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911205112.XA CN112887045B (en) | 2019-11-29 | 2019-11-29 | Message transmission method and device, FPGA (field programmable Gate array) and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112887045A CN112887045A (en) | 2021-06-01 |
CN112887045B true CN112887045B (en) | 2023-03-24 |
Family
ID=76038991
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911205112.XA Active CN112887045B (en) | 2019-11-29 | 2019-11-29 | Message transmission method and device, FPGA (field programmable Gate array) and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112887045B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20230269161A1 (en) * | 2022-02-24 | 2023-08-24 | Marvell Israel (M.I.S.L) Ltd. | Dynamic one-step/two-step timestamping per packet in network devices |
WO2023161883A1 (en) * | 2022-02-24 | 2023-08-31 | Marvell Israel (M.I.S.L) Ltd. | Dynamic one-step/two-step timestamping per packet in network devices |
US20230269015A1 (en) * | 2022-02-24 | 2023-08-24 | Marvell Israel (M.I.S.L) Ltd. | Timestamping over media independent interfaces |
US20230269018A1 (en) * | 2022-02-24 | 2023-08-24 | Marvell Israel (M.I.S.L) Ltd. | Dynamic one-step/two-step timestamping per packet in network devices |
US11924318B2 (en) | 2022-02-24 | 2024-03-05 | Marvell Israel (M.I.S.L) Ltd. | Timestamping for multiple synchronization domains in a network device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002028139A1 (en) * | 2000-09-27 | 2002-04-04 | Synchrodyne Networks, Inc. | Switching methods with a plurality of time intervals |
CN101783772A (en) * | 2010-03-23 | 2010-07-21 | 华为技术有限公司 | Method, device and system for encapsulating and de-encapsulating messages |
CN101977104A (en) * | 2010-11-13 | 2011-02-16 | 上海交通大学 | IEEE1588 based accurate clock synchronization protocol system and synchronization method thereof |
CN108155982A (en) * | 2016-12-02 | 2018-06-12 | 深圳市中兴微电子技术有限公司 | A kind of timestamp processing method and equipment |
CN108429596A (en) * | 2018-01-26 | 2018-08-21 | 武汉中元华电电力设备有限公司 | A kind of ethernet mac module realization device and implementation method for IEEE 1588v2 agreements |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7317898B2 (en) * | 2004-03-31 | 2008-01-08 | Searete Llc | Mote networks using directional antenna techniques |
-
2019
- 2019-11-29 CN CN201911205112.XA patent/CN112887045B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002028139A1 (en) * | 2000-09-27 | 2002-04-04 | Synchrodyne Networks, Inc. | Switching methods with a plurality of time intervals |
CN101783772A (en) * | 2010-03-23 | 2010-07-21 | 华为技术有限公司 | Method, device and system for encapsulating and de-encapsulating messages |
CN101977104A (en) * | 2010-11-13 | 2011-02-16 | 上海交通大学 | IEEE1588 based accurate clock synchronization protocol system and synchronization method thereof |
CN108155982A (en) * | 2016-12-02 | 2018-06-12 | 深圳市中兴微电子技术有限公司 | A kind of timestamp processing method and equipment |
CN108429596A (en) * | 2018-01-26 | 2018-08-21 | 武汉中元华电电力设备有限公司 | A kind of ethernet mac module realization device and implementation method for IEEE 1588v2 agreements |
Also Published As
Publication number | Publication date |
---|---|
CN112887045A (en) | 2021-06-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112887045B (en) | Message transmission method and device, FPGA (field programmable Gate array) and electronic equipment | |
CN112385183B (en) | Apparatus, method and microcontroller for performing PHY level hardware timestamp and time synchronization | |
KR101109897B1 (en) | Server time protocol messages and methods | |
CN112838903B (en) | Clock synchronization method, equipment and storage medium | |
CN111726189B (en) | Dual-core system clock synchronization method and device based on timestamp marking circuit | |
KR20080073228A (en) | Clock synchronization aid device for communication station(s) of a wireless network, and associated clock synchronization device | |
WO2010057398A1 (en) | Device and method for implementing clock transparent transmission | |
CN110572230A (en) | correction method and device for realizing time synchronization | |
CN103138887A (en) | Processing method of 1588 event messages and processing method of 1588 event messages | |
JP2022547891A (en) | Method, apparatus and system for selecting clock source and storage medium | |
CN112398567B (en) | Clock synchronization method and device in encryption communication process and multi-device system | |
CN115208806B (en) | Method and device for testing NTP server response capability | |
WO2021233313A1 (en) | Port state configuration method, apparatus, system, and storage medium | |
CN107425936A (en) | A kind of transparent clock measurement apparatus | |
CN115865246A (en) | Time synchronization device, system and method | |
CN114071487B (en) | Interface delay measurement method, related network equipment and storage medium | |
CN111628914B (en) | Periodic communication network link delay measurement method and system and FPGA | |
CN101420281B (en) | Method and arrangement for transferring a time of day value between network elements | |
CN113411157B (en) | Method, slave clock device, master clock device and system for clock synchronization | |
KR100539018B1 (en) | Method and device for processing data packets which have been received or are to be transmitted on a data channel | |
CN109995453B (en) | Information processing method, device, equipment and computer readable storage medium | |
CN113259039A (en) | Time synchronization method and device, computer equipment and storage medium | |
JP2001244932A (en) | Method and system for measuring network delay | |
CN114257469A (en) | Communication method, device and medium of EtherCAT main station | |
WO2013078809A1 (en) | Time-delay performance monitoring method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |