CN115632736A - Method, device and equipment for supporting high-precision clock service - Google Patents

Method, device and equipment for supporting high-precision clock service Download PDF

Info

Publication number
CN115632736A
CN115632736A CN202211104361.1A CN202211104361A CN115632736A CN 115632736 A CN115632736 A CN 115632736A CN 202211104361 A CN202211104361 A CN 202211104361A CN 115632736 A CN115632736 A CN 115632736A
Authority
CN
China
Prior art keywords
service
network card
intelligent network
service message
precision clock
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
CN202211104361.1A
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.)
New H3C Technologies Co Ltd
Original Assignee
New H3C Technologies 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 New H3C Technologies Co Ltd filed Critical New H3C Technologies Co Ltd
Priority to CN202211104361.1A priority Critical patent/CN115632736A/en
Publication of CN115632736A publication Critical patent/CN115632736A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0682Clock or time synchronisation in a network by delay compensation, e.g. by compensation of propagation delay or variations thereof, by ranging

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a method, a device and equipment for supporting high-precision clock service. The invention installs the intelligent network card supporting the high-precision clock synchronization protocol on the virtualization device, and starts the high-precision clock synchronization function of the intelligent network card to realize the clock synchronization of the intelligent network card and the high-precision clock source. Issuing a hardware flow table aiming at a service needing a high-precision clock for an intelligent network card, and adding a sending timestamp for the service message based on the high-precision clock on the intelligent network card in the service message when the service message of the specified service is forwarded outwards by the intelligent network card through the hardware flow table; and adding a receiving timestamp for the service message based on the high-precision clock on the intelligent network card in the service message when the service message of the specified service is forwarded inwards by the intelligent network card through the hardware flow table. The invention can realize the support of deploying the high-precision clock service on the server which does not support the high-precision clock, and reduces the deployment cost of the high-precision clock service.

Description

Method, device and equipment for supporting high-precision clock service
Technical Field
The invention relates to the technical field of communication and cloud computing, in particular to a method, a device and equipment for supporting high-precision clock service.
Background
The Smart NIC (intelligent network card) can transfer the functions of the virtual switch from a Central Processing Unit (CPU) on a server mainboard (server CPU for short) to the network card, and release the computing power of the expensive server CPU to return to an application program, so that the functions of the network card can be better expanded and higher performance can be provided.
The core idea of the intelligent network card is to assist a CPU to process network load through a field programmable gate array FPGA and program a network interface function, and the intelligent network card has the following characteristics:
(1) The functions of a data plane and a control plane are customized through FPGA (field programmable gate array) localized programming, so that a CPU (central processing unit) is assisted to process network loads;
(2) The system generally comprises a plurality of ports and internal switches, and is used for quickly forwarding data and intelligently mapping the data to related application programs based on network data packets, application program sockets and the like;
(3) Network traffic is detected and managed.
The Smart NIC can improve the performance and virtualization performance of an application program, realize many advantages of Software Defined Networking (SDN) and Network Function Virtualization (NFV), remove Network virtualization, load balancing and other low-level functions from a server CPU, and ensure that the maximum processing capability is provided for the application. Meanwhile, the intelligent network card can also provide distributed computing resources, so that a user can develop own software or provide access service, and specific application programs are accelerated.
At present, there are two general schemes for supporting a high-precision clock by a service application system:
the first mode is a global satellite positioning system clock synchronization mode, which receives 1pps and serial port time information by using synchronous satellite signals of satellite positioning systems such as Beidou and GPS, and synchronizes a local clock and a clock of the satellite positioning system.
The second method is a Time synchronization Protocol clock synchronization method, which uses a Time synchronization Protocol such as Precision Time Protocol (PTP) to achieve high-Precision clock synchronization between devices. The clock synchronization precision of the PTP can reach sub-microsecond level.
Because the cost of the clock synchronization scheme of the satellite positioning system is high, the clock synchronization protocol scheme is mostly adopted in the industry.
The PTP protocol standard is PTP profile. Different types of PTP protocol standards may implement different PTP functions. PTP protocol standards include the following types:
IEEE 1588version 2: 1588v2 for short. IEEE 1588 specifies the principle for high-precision clock synchronization and the specification for message interaction processing in networks, which were originally applied to industrial automation and are now mainly used for bridging local area networks. IEEE 1588 has no mandatory requirements on network environment, has wide applicability, and can customize the protocol standard according to different application environments to enhance or tailor specific functions. The latest version is the V2 version, namely 1588V2.
IEEE 802.1AS: referred to AS 802.1AS. The 802.1AS is a protocol standard generated based on IEEE 1588, and the realization of IEEE 1588 in a bridged local area network is refined. The BMC (Best Master Clock) algorithm supported by 802.1AS is slightly different from IEEE 1588, and refers to an implementation manner of MSTP (Multiple Spanning Tree Protocol). The physical media types supported by the 802.1AS are only point-to-point full duplex ethernet links, IEEE 802.11 links, and IEEE 802.3EPON links.
A network to which the PTP protocol is applied is called a PTP domain. There is one and only one clock source in the PTP domain, with which all devices in the domain remain synchronized.
Nodes in the PTP domain are called clock nodes, and interfaces in which the PTP protocol runs on the clock nodes are called PTP interfaces. The IEEE 1588version 2 and IEEE 802.1AS protocol standards define the following types of basic clock nodes:
common Clock (OC) node: only one PTP interface of the clock node of the type participates in time synchronization in the same PTP domain, and time is synchronized from an upstream clock node through the interface. In addition, when the clock node is used as a clock source, the time can be issued to the downstream clock node through only one PTP interface.
Boundary Clock (BC) node: the clock node of the type has a plurality of PTP interfaces in the same PTP domain to participate in time synchronization, and synchronizes time from an upstream clock node through one interface and distributes time to a downstream clock node through the other interfaces. In addition, when a clock node is used as a clock source, time can be distributed to downstream clock nodes through a plurality of PTP interfaces.
Transparent Clock (TC) node: the clock node of the type is provided with a plurality of PTP interfaces, but the clock node only forwards PTP protocol messages among the interfaces and carries out forwarding delay correction on the PTP protocol messages, and time cannot be synchronized through any interface. In contrast to BC/OC, BC/OC needs to maintain time synchronization with other clock nodes, while TC does not.
The TC nodes in turn include two types:
End-to-End Transparent Clock (E2 ETC): the node directly forwards a non-P2P (Peer-to-Peer) PTP protocol message in the network, and participates in calculating the delay of the whole link.
Peer-to-Peer Transparent Clock (P2 PTC): the node only directly transmits the Sync message, the Follow _ Up message and the Announce message, terminates other PTP protocol messages and participates in calculating the time delay of each section of link on the whole link.
Fig. 1 is a schematic diagram of positions of PTP basic clock nodes in a PTP domain and PTP interfaces. In addition to the basic clock node, there are also mixed clock nodes, such as TC + OC that merge the characteristics of TC and OC: the PTP domain has a plurality of PTP interfaces in the same PTP domain, wherein one interface is of an OC type, and the other interfaces are of TC types. On one hand, the PTP protocol message is forwarded through a TC type interface, and forwarding delay correction is carried out on the PTP protocol message; on the other hand, it performs time synchronization through an OC type interface. Similar to the classification of TC, TC + OC also includes two types: e2ETC + OC and P2PTC + OC.
The protocol standard defines parameters such as time precision, time level, time attribute, clock deviation measurement and the like to describe the quality of a PTP clock source signal. The user carries out personalized customization and supplementation on the protocol standard according to the network condition of the user, and respective technical standards are formed. Currently, there are three technical standards, the default technical standard, the OAM technical standard and the Unicom technical standard. Different technical standards require different default values for these parameters. Different clock sources may be elected in the same network by using different technical standards, and the processing modes of PTP messages are also different by the different technical standards.
The Master-Slave relationship (Master-Slave) between the clock nodes is relative, and for a pair of clock nodes synchronized with each other, the following Master-Slave relationship exists:
master/slave nodes: the clock Node that issues the synchronization time is called a Master Node (Master Node), and the clock Node that receives the synchronization time is called a Slave Node (Slave Node).
Master/slave clocks: the Clock on the Master node is called the Master Clock (Master Clock) and the Clock on the Slave node is called the Slave Clock (Slave Clock).
Master/slave/passive interface: the PTP interface that issues the synchronization time on the clock node is called Master Port (Master Port), and the PTP interface that receives the synchronization time is called Slave Port (Slave Port), and both the Master interface and the Slave interface can exist on BC or OC. PTP interfaces, which neither publish nor receive synchronization time, are called Passive interfaces (Passive ports).
The clock node supports the following two clock sources:
a local clock source: the 38.88MHz clock signal generated by the internal crystal oscillator of the clock monitoring module.
External clock source (ToD clock source): the clock is generated by an external clock device and is transmitted and received through a special interface (namely, a 1PPS/ToD interface) on the main control board, so that the clock is also called a ToD clock source.
As in the example of fig. 1, all Clock nodes in a PTP domain are organized together in a certain hierarchy, and the reference time of the whole domain is the optimum Clock (GM), i.e. the highest level Clock. The optimal clock of the whole PTP domain is selected by interacting PTP protocol messages among the clock nodes according to information such as clock priority, time level, clock precision and the like carried in the PTP protocol messages. The time of the best clock will eventually be synchronized to the entire PTP domain and is therefore also referred to as the clock source of the PTP domain.
At present, in the scenes of industrial internet, rail transit and the like, a high-precision clock is needed to meet the requirement of a signal system, and in these scenes, a special device is usually used to realize a high-precision clock technology, such as a special clock server and the like. However, devices such as a dedicated clock server are expensive, and users need to use a wider general X86 server to reduce costs by matching with virtualization technology. At present, a common X86 server cannot be equipped with hardware chips such as a stable crystal oscillator and the like required by a high-precision clock, and a virtual machine cannot sense the hardware clock and can only adopt a timing synchronization mechanism to synchronize with a clock source, so that the high-precision clock requirement cannot be realized.
Disclosure of Invention
In view of this, the present invention provides a method, an apparatus, and a device for supporting a high-precision clock service, which are used to solve the technical problem that a virtualization device does not support the high-precision clock service.
Based on an aspect of an embodiment of the present invention, the present invention provides a method for supporting a high-precision clock service, where the method is applied to a first server (server a), a first intelligent network card (intelligent network card a) is installed on the first server, the first intelligent network card supports a high-precision clock synchronization protocol, a first virtual machine (virtual machine A1) runs on the first server, and a high-precision clock service application runs on the first virtual machine, and the method includes:
the method comprises the steps that a first intelligent network card receives a first service message of a high-precision clock service sent by a first virtual machine on a first server;
a first hardware flow table on a first intelligent network card is used for stamping a sending timestamp for the first service message and then forwarding the first service message;
the matching domain of the first hardware flow table is used for matching the IP address of the first virtual machine and the designated port number of the high-precision clock service; and the action domain is used for printing a high-precision timestamp of the first intelligent network card on the first service message as a sending timestamp of the first service message.
Further, the method further comprises:
the first intelligent network card receives a second service message (service message sent by the intelligent network card B) of the high-precision clock service from the outside; the second service message carries a sending timestamp of the second service message printed by an opposite terminal (intelligent network card B);
the second service message is printed with a receiving timestamp through a second hardware flow table on the first intelligent network card and then forwarded to the high-precision clock service application on the first virtual machine;
the matching domain of the second hardware flow table is used for matching the IP address of the first virtual machine and the designated port number of the high-precision clock service; and the action domain is used for printing the high-precision timestamp of the first intelligent network card on the second service message as the receiving timestamp of the second service message.
Further, the method further comprises:
and the high-precision clock service application acquires a receiving time stamp in the second service message from the received second service message, and takes the receiving time stamp in the second service message as the receiving time of the high-precision clock service application for receiving the second service message.
Further, the method further comprises:
and the first intelligent network card receives a confirmation message of the first service message from the outside, and the confirmation message carries a sending timestamp (ta 1) printed by the first intelligent network card for the first service message and a receiving timestamp (tb 1) printed by an opposite terminal (intelligent network card B) for receiving the first service message.
Furthermore, the first intelligent network card synchronizes a high-precision clock from an external high-precision clock source through a high-precision clock synchronization protocol, so that the core clock of the first intelligent network card is synchronized with the external high-precision clock source.
Further, the first service packet and the second service packet are service packets of a TCP protocol type; and carrying the sending time stamp and the receiving time stamp in a time stamp option field in the service message of the TCP protocol type.
Based on another aspect of an embodiment of the present invention, the present invention further provides an apparatus for supporting a high-precision clock service, where the apparatus is applied to a first server (server a), and the apparatus includes:
a first virtual machine (virtual machine A1) on which a high-precision clock service application runs;
a first intelligent network card (intelligent network card A) which supports a high-precision clock synchronization protocol;
the first intelligent network card is used for receiving a first service message of a high-precision clock service sent by a first virtual machine; the first service message is printed with a sending timestamp through a first hardware flow table on a first intelligent network card and then forwarded outwards;
the matching domain of the first hardware flow table is used for matching the IP address of the first virtual machine and the designated port number of the high-precision clock service; and the action domain is used for printing a high-precision timestamp of the first intelligent network card on the first service message as a sending timestamp of the first service message.
Further, the first intelligent network card is further configured to receive a second service packet (service packet sent by the intelligent network card B) of the high-precision clock service from the outside; the second service message carries a sending timestamp of the second service message printed by an opposite terminal (intelligent network card B);
the first intelligent network card is also used for printing a receiving timestamp on the second service message through a second hardware flow table on the first intelligent network card and forwarding the second service message to the high-precision clock service application on the first virtual machine;
the matching domain of the second hardware flow table is used for matching the IP address of the first virtual machine and the designated port number of the high-precision clock service; and the action domain is used for stamping a high-precision timestamp of the first intelligent network card for the second service message as a receiving timestamp of the second service message.
Furthermore, the first intelligent network card is further configured to synchronize a high-precision clock from an external high-precision clock source through a high-precision clock synchronization protocol, so that the kernel clock of the first intelligent network card is synchronized with the external high-precision clock source.
Based on another aspect of an embodiment of the present invention, the present invention further provides an electronic device, including a processor, a communication interface, a storage medium, and a communication bus, where the processor, the communication interface, and the storage medium complete communication with each other through the communication bus;
a storage medium for storing a computer program;
a processor for implementing the steps of the above method when executing the computer program stored on the storage medium.
According to another aspect of an embodiment of the present invention, there is also provided a storage medium having a computer program stored thereon, the computer program implementing the steps described above when executed by a processor.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments of the present invention or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings may be obtained according to the drawings of the embodiments of the present invention.
FIG. 1 is a schematic diagram of positions of PTP basic clock nodes in a PTP domain and a PTP interface;
fig. 2 is a schematic diagram of a networking structure of a virtualization system supporting high-precision clock services according to an embodiment of the present invention;
FIG. 3 is a schematic process diagram of a PTP protocol two-step mode transmission delay measurement method;
fig. 4 is a schematic flowchart illustrating steps of a method for supporting a high-precision clock service according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device for implementing a method for supporting a high-precision clock service according to an embodiment of the present invention.
Detailed Description
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the embodiments of the invention. As used in the embodiments of the present invention, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The term "and/or" as used herein is meant to encompass any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used to describe various information in embodiments of the present invention, the information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of embodiments of the present invention. Depending on the context, moreover, the word "if" is used may be interpreted as "at … …" or "at … …" or "in response to a determination".
In some application scenarios that need to support a high-precision clock, such as the fields of industrial internet, rail transit, and automatic driving services, in order to utilize existing server resources or reduce system cost, server resources that do not support a high-precision clock may be used and virtual machines are deployed on the servers to provide service for the service scenarios, however, since the server where the virtual machine is located does not support a high-precision clock, the virtual machine thereon cannot obtain a high-precision hardware clock from the server, and thus, a service on the virtual machine that requires a high-precision clock cannot meet the service requirements of the services because the local high-precision clock cannot be obtained.
Based on the above technical problem, the present invention provides a method for supporting high-precision clock services, and the method has the following basic ideas: installing an intelligent network card supporting a high-precision clock synchronization protocol on virtualization equipment (such as a server, a host, a personal computer, mobile terminal equipment and the like supporting virtualization), and starting a high-precision clock synchronization function of the intelligent network card to realize clock synchronization of the intelligent network card and a high-precision clock source. Issuing a hardware flow table aiming at a service needing a high-precision clock for an intelligent network card, and adding a sending timestamp for the service message based on the high-precision clock on the intelligent network card in the service message when the service message of a specified service is forwarded outwards by the intelligent network card through the hardware flow table; and adding a receiving timestamp for the service message based on the high-precision clock on the intelligent network card in the service message when the service message of the specified service is forwarded inwards by the intelligent network card through the hardware flow table. According to the invention, the high-precision clock service on the virtual machine can directly acquire the high-precision clock on the intelligent network card from the service message through the hardware flow table, so that the high-precision clock service can be deployed on a server which does not support the high-precision clock, and the deployment cost of the high-precision clock service is reduced.
Fig. 2 is a schematic diagram of a networking structure of a virtualization system supporting high-precision clock services according to an embodiment of the present invention. In the example of the figure, a server a and a server B supporting virtualization are respectively deployed with virtual machines A1 and A2 and virtual machines B1 and B2, and the virtual machines A1 and B1 are deployed with services requiring high-precision clocks, but the server a and the server B do not support high-precision clocks. The server A is provided with an intelligent network card A, and the server B is provided with an intelligent network card B. The intelligent network card a, the intelligent network card B and the physical forwarding device (such as a switch or a router) support a high-precision clock synchronization protocol (such as a PTP protocol).
The intelligent network card A and the intelligent network card B have slave clock ports, and the master clock port of the physical forwarding device connected with the slave clock ports synchronizes high-precision clocks, a user can configure the intelligent network card from an out-of-band management port of the intelligent network card, the PTP function of the intelligent network card is started, the intelligent network cards A and B are set as slave clock nodes, the forwarding device can be configured as a master clock node through the management interface on the forwarding device, the port connected with the forwarding device on the intelligent network card is set as a slave clock port, and the port connected with the intelligent network card on the forwarding device is set as a master clock port.
After the PTP function is turned on, a central processing unit CPU of the intelligent network card can perform PTP protocol message interaction with the forwarding equipment according to the PTP protocol requirement so as to synchronize a high-precision clock, and the forwarding equipment can also synchronize the clock of the external high-precision clock source from the external high-precision clock source through the PTP protocol. The intelligent network card can be matched with the PTP message through the hardware flow table, and the receiving time or the sending time is written in the timestamp field of the message, so that the intelligent network card can realize the high-precision clock function.
To aid understanding, the basic principles of PTP protocol clock synchronization are described below:
after the master-slave relationship between the clocks is confirmed, PTP protocol messages are interacted between the master clock and the slave clock, the receiving and sending time of the messages is recorded, and the round-trip total delay between the master clock and the slave clock is calculated by calculating the round-trip time difference of the PTP protocol messages. If the transmission delays in both directions are the same, half of the total round-trip delay is the one-way delay. The slave clock calculates the time deviation according to the one-way delay, the sending time of the synchronous Sync message on the master clock and the time difference of the synchronous Sync message received on the slave clock, and the slave clock adjusts the local time according to the time deviation, so that the synchronization of the slave clock and the master clock can be realized.
The PTP protocol defines two transmission delay measurement mechanisms: a Request-Response (Request _ Response) mechanism and a Peer Delay (Peer Delay) mechanism, both of which are premised on network symmetry.
In an embodiment of the present invention, a request-response mechanism may be selectively used between the intelligent network card and the physical switching device to synchronize the high-precision clock, and the end-delay mechanism may be implemented with reference to the implementation principle of the request-response mechanism.
And under the request response mechanism, the master clock and the slave clock calculate the average path delay between the master clock and the slave clock according to the transmitted PTP protocol message. If TC exists between the master clock and the slave clock, the TC does not calculate average path delay, only transmits the received PTP protocol message, and transmits the residence time of the synchronous message, namely the Sync message, on the TC to the slave clock.
The request response mechanism is divided into a double-step mode and a single-step mode according to whether a Follow-Up message, namely a Follow _ Up message, needs to be sent or not:
fig. 3 is a process diagram of a PTP protocol two-step mode transmission delay measurement method. In the double-step mode, the sending timestamp t1 of the Sync message is carried by a Follow _ Up message. In the single step mode, the sending timestamp t1 of the Sync message is carried by the Sync message, and the Follow _ Up message is not sent.
Referring to the example of fig. 3, the following describes the implementation process of the request-response mechanism by taking the two-step mode as an example:
(1) The master clock node sends a Sync message to the slave clock node and records the sending time t1; and after receiving the message from the clock node, recording the receiving time t2.
(2) After the master clock node sends the Sync message, a Follow _ Up message carrying t1 is sent.
(3) The slave clock node sends a Delay request message, namely a Delay _ Req message, to the master clock node, and is used for initiating the calculation of the Delay of the reverse transmission and recording the sending time t3; and after receiving the message, the master clock node records the receiving time t4.
(4) After receiving the Delay _ Req message, the master clock node replies a Delay request response message, i.e. a Delay _ Resp message, carrying t4.
At this time, the slave clock node has four time stamps t1 to t4, and thus can calculate:
total round-trip delay between master and slave clock nodes = (t 2-t 1) + (t 4-t 3)
One-way delay between master and slave clock nodes = [ (t 2-t 1) + (t 4-t 3) ]/2
Clock Offset of the slave clock node relative to the master clock node = (t 2-t 1) - [ (t 2-t 1) + (t 4-t 3) ]/2= [ (t 2-t 1) - (t 4-t 3) ]/2=
The intelligent network card A on the server A and the intelligent network card B on the server B acquire high-precision clocks from the physical forwarding equipment through a high-precision clock synchronization protocol, so that the virtual machines on the server A and the server B have a foundation for supporting high-precision clock services. The high-precision clock service in the embodiment of the invention is a service which has high real-time requirement on the service and is based on a high-precision clock, such as industrial internet, rail transit, unmanned service and the like.
Fig. 4 is a schematic step flow diagram of a method for supporting a high-precision clock service according to an embodiment of the present invention, and for convenience of description, the example of fig. 4 is described based on the network structure of fig. 2, but the implementation of the technical solution of the present invention is not limited to the simple network structure of the example of fig. 2, and is also applicable to a more complex networking structure in an actual service scenario.
The hardware of the server A and the hardware of the server B do not have a high-precision clock source, but the services of the virtual machine A1 deployed on the server A and the virtual machine B1 deployed on the server B need high-precision clock support, in order to realize the support of the server A and the server B on the high-precision clock services under the scene, the intelligent network card A and the intelligent network card B which support high-precision clock synchronization are respectively installed on the server A and the server B, and the high-precision time timestamp of the intelligent network card is marked for the forwarded messages of the high-precision clock services through the hardware flow tables on the intelligent network card A and the intelligent network card B, so that the server A and the server B can support the high-precision clock services.
In order to achieve the above purpose, when creating the virtual machine A1 and the virtual machine B on the virtualization platform, a virtual machine image file supporting a high-precision clock service needs to be selected for creation, and a designated port number is configured for the high-precision clock service. Assuming that a high-precision clock service message is interacted between a virtual machine A and a virtual machine B through a TCP, a TCP port number 1234 is configured on the virtual machine A and the virtual machine B as a designated port number of the high-precision clock service, and the designated port number needs to be informed to a virtualization platform. A network controller (such as a Software Defined Network (SDN) controller) of a management layer in the virtualization platform issues a hardware flow table to the intelligent network card a and the intelligent network card B according to information such as IP addresses and assigned port numbers of the virtual machine a and the virtual machine B, and a high-precision timestamp is stamped on a forwarded message of the high-precision clock service through the hardware flow table.
The following describes the flow of the method steps for supporting the high-precision clock service in this embodiment with reference to fig. 4:
step 401, a virtual machine A1 on a server A sends a service message of a high-precision clock service to a virtual machine B1 on a server B, and the service message is forwarded outwards through an intelligent network card A on the virtual machine A1;
step 402, the intelligent network card A is used as a high-precision clock node, after receiving a service message, the intelligent network card A is matched with a first hardware flow table, and a sending timestamp (ta 1) is printed on the service message through the first hardware flow table; the matching field of the first hardware flow table is used for matching the IP address of the virtual machine A1 and the specified port number (such as 1234) of the high-precision clock traffic; the action domain is used for printing a high-precision timestamp of the intelligent network card A on the service message as a sending timestamp (ta 1) of the service message;
taking a service message of a high-precision clock service as a TCP protocol message as an example, the TCP protocol reserves a timestamp option field in a TCP option field. The timestamp option field (which takes 10 bytes) includes: a type field kid (1 byte), a length field length (1 byte), and an information field info (8 bytes), wherein the info field may be composed of two parts of a timestamp field timestamp (4 bytes) and a timestamp loopback field timestamp echo (4 bytes).
The matching domain key of the first hardware flow table issued by the virtualization platform to the intelligent network card a includes the IP address of the virtual machine a and the specified port number (i.e. source IP address and source port number) of the high-precision clock service, and the action of the action domain action is as follows: and writing the current timestamp (ta 1) of the kernel clock synchronized by the intelligent network card A through the high-precision clock synchronization protocol into a timestamp field timestamp of the service message, wherein the ta1 is used as a sending timestamp sent by the service message from a sending end.
Step 403, the intelligent network card A forwards the service message with the sending timestamp (ta 1) to the intelligent network card B;
when the service packet is a protocol packet of a high-precision clock service, the embodiment further includes a step of returning a confirmation packet of the service packet (step 4031 to step 4032). For the data message, a loopback confirmation message is not needed, and whether the loopback confirmation message is needed or not can be determined according to the actual service requirement.
4031, when receiving the service message, the intelligent network card B sends back an acknowledgement message (ack) to the intelligent network card a; and filling the time (tb 1) when the intelligent network card B receives the service message by using the timestamp field timestamp of the confirmation message, and filling the sending timestamp (ta 1) of the service message by using the timestamp echo field timestamp echo of the confirmation message.
Step 4032, after receiving the acknowledgement message, the smart card a calculates the Round Trip Time (RTT) of the message between the smart card a and the smart card B by using the value in the timestamp field timestamp and the timestamp loopback field timestamp echo.
Step 404, the intelligent network card B is used as a high-precision clock node, after receiving the service message, the intelligent network card B is matched with a second hardware flow table, and a receiving timestamp (tb 1) is marked for the service message through the second hardware flow table; the matching field of the service hardware flow table is used for matching the IP address of the virtual machine B1 and the specified port number of the high-precision clock service (namely matching the destination IP address and the destination port number); the action domain is used for printing a high-precision timestamp of the intelligent network card B for the service message as a receiving timestamp (tb 1) of the service message;
for example, the intelligent network card B stamps a receiving timestamp (tb 1) in the timestamp echo of the TCP protocol service packet, and then forwards the service packet to the virtual machine B1.
And 405, the intelligent network card B sends the service message carrying the sending timestamp (ta 1) and the receiving timestamp (tb 1) to the virtual machine B1 on the server B.
After receiving a service message of a TCP protocol, a high-precision clock service application on the virtual machine B1 takes the sending timestamp (ta 1) from the timestamp as the accurate time for the virtual machine A1 to send the service message, and takes the receiving timestamp (tb 1) from the timestamp echo as the accurate time for the virtual machine B1 to receive the service message. The high-precision clock service on the virtual machine B1 can use the accurate time to make its own service logic such as industrial internet or rail transit, and the specific service processing logic is not within the protection scope of the present invention, and therefore is not described in detail.
Because the mode of obtaining the time stamp of the service message on the virtual machines A1 and B1 is different from that of the existing physical equipment, the high-precision clock service application can add configuration items, select whether the current operating environment is the virtual machine or the physical equipment, and perform different processing of obtaining the time stamp according to the selection, if the current operating environment is the virtual machine, the time stamp is obtained from the service message, and if the current operating environment is the physical equipment, the system time is directly obtained.
Since the TCP protocol belongs to a high-reliability protocol, the application of the high-precision clock in the embodiment of the present invention preferably uses a TCP packet, and if an unreliable transport protocol such as UDP is used, a timestamp can be written by using a similar timestamp option field in the UDP protocol or adding a new field, which is not described in detail herein.
Fig. 5 is a schematic structural diagram of an electronic device for implementing a method for supporting a high-precision clock service according to an embodiment of the present invention, where the device 500 includes: a processor 510 such as a Central Processing Unit (CPU), a communication bus 520, a communication interface 540, and a storage medium 530. Wherein the processor 510 and the storage medium 530 may communicate with each other through a communication bus 520. The storage medium 530 stores therein a computer program that, when executed by the processor 510, performs the functions of one or more steps of the method for supporting a high-precision clock service provided by the present invention.
The storage medium may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. In addition, the storage medium may 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), etc.; 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.
It should be recognized that embodiments of the present invention can be realized and implemented by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory memory. The method may be implemented in a computer program using standard programming techniques, including a non-transitory storage medium configured with the computer program, where the storage medium so configured causes a computer to operate in a specific and predefined manner. Each program may be implemented in a high level procedural or object oriented programming language to communicate with a computer system. However, the program(s) can be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language. Furthermore, the program can be run on a programmed application specific integrated circuit for this purpose. Further, operations of processes described herein may be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and/or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions and may be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) collectively executed on one or more processors, by hardware, or combinations thereof. The computer program includes a plurality of instructions executable by one or more processors.
Further, the method may be implemented in any type of computing platform operatively connected to a suitable connection, including but not limited to a personal computer, mini computer, mainframe, workstation, networked or distributed computing environment, separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, or the like. Aspects of the invention may be embodied in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, optically read and/or write storage medium, RAM, ROM, or the like, such that it may be read by a programmable computer, which when read by the storage medium or device, is operative to configure and operate the computer to perform the procedures described herein. Further, the machine-readable code, or portions thereof, may be transmitted over a wired or wireless network. The invention described herein includes these and other different types of non-transitory computer-readable storage media when such media include instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor. The invention also includes the computer itself when programmed according to the methods and techniques described herein.
The above description is only an example of the present invention, and is not intended to limit the present invention. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (11)

1. A method for supporting high-precision clock service is characterized in that the method is applied to a first server, a first intelligent network card is installed on the first server, the first intelligent network card supports a high-precision clock synchronization protocol, a first virtual machine runs on the first server, and a high-precision clock service application runs on the first virtual machine, and the method comprises the following steps:
the method comprises the steps that a first intelligent network card receives a first service message of a high-precision clock service sent by a first virtual machine on a first server;
a first hardware flow table on a first intelligent network card is used for stamping a sending timestamp for the first service message and then forwarding the first service message;
the matching domain of the first hardware flow table is used for matching the IP address of the first virtual machine and the designated port number of the high-precision clock service; and the action domain is used for printing a high-precision timestamp of the first intelligent network card on the first service message as a sending timestamp of the first service message.
2. The method of claim 1, further comprising:
the first intelligent network card receives a second service message of the high-precision clock service from the outside; the second service message carries a sending timestamp of the second service message marked by an opposite terminal;
the second service message is forwarded to the high-precision clock service application on the first virtual machine after being stamped with the receiving timestamp through a second hardware flow table on the first intelligent network card;
the matching domain of the second hardware flow table is used for matching the IP address of the first virtual machine and the designated port number of the high-precision clock service; and the action domain is used for printing the high-precision timestamp of the first intelligent network card on the second service message as the receiving timestamp of the second service message.
3. The method of claim 2, further comprising:
and the high-precision clock service application acquires a receiving time stamp in the second service message from the received second service message, and the receiving time stamp in the second service message is used as the receiving time of the high-precision clock service application for receiving the second service message.
4. The method of claim 1, further comprising:
and the first intelligent network card receives a confirmation message of the first service message from the outside, and the confirmation message carries a sending time stamp stamped by the first intelligent network card for the first service message and a receiving time stamp stamped by an opposite terminal for receiving the first service message.
5. The method of claim 1,
and the first intelligent network card synchronizes a high-precision clock from an external high-precision clock source through a high-precision clock synchronization protocol, so that the core clock of the first intelligent network card is synchronized with the external high-precision clock source.
6. The method of claim 2,
the first service message and the second service message are service messages of a TCP protocol type;
and carrying the sending time stamp and the receiving time stamp in a time stamp option field in the service message of the TCP protocol type.
7. An apparatus for supporting high-precision clock services, the apparatus being applied to a first server, the apparatus comprising:
the system comprises a first virtual machine, a second virtual machine and a third virtual machine, wherein a high-precision clock service application runs on the first virtual machine;
the first intelligent network card supports a high-precision clock synchronization protocol;
the first intelligent network card is used for receiving a first service message of a high-precision clock service sent by a first virtual machine; the first service message is forwarded to the outside after a sending timestamp is printed on the first service message through a first hardware flow table on a first intelligent network card;
the matching domain of the first hardware flow table is used for matching the IP address of the first virtual machine and the designated port number of the high-precision clock service; and the action domain is used for printing a high-precision timestamp of the first intelligent network card on the first service message as a sending timestamp of the first service message.
8. The apparatus of claim 7,
the first intelligent network card is also used for receiving a second service message of the high-precision clock service from the outside; the second service message carries a sending timestamp of the second service message marked by an opposite terminal;
the first intelligent network card is also used for printing a receiving timestamp on the second service message through a second hardware flow table on the first intelligent network card and forwarding the second service message to the high-precision clock service application on the first virtual machine;
the matching domain of the second hardware flow table is used for matching the IP address of the first virtual machine and the designated port number of the high-precision clock service; and the action domain is used for stamping a high-precision timestamp of the first intelligent network card for the second service message as a receiving timestamp of the second service message.
9. The apparatus of claim 7,
and the first intelligent network card is also used for synchronizing a high-precision clock from an external high-precision clock source through a high-precision clock synchronization protocol, so that the kernel clock of the first intelligent network card is synchronized with the external high-precision clock source.
10. An electronic device is characterized by comprising a processor, a communication interface, a storage medium and a communication bus, wherein the processor, the communication interface and the storage medium are communicated with each other through the communication bus;
a storage medium for storing a computer program;
a processor for performing the method steps of any one of claims 1-6 when executing a computer program stored on a storage medium.
11. A storage medium having stored thereon a computer program, characterized in that the computer program, when executed by a processor, implements the method according to any of claims 1 to 6.
CN202211104361.1A 2022-09-09 2022-09-09 Method, device and equipment for supporting high-precision clock service Pending CN115632736A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211104361.1A CN115632736A (en) 2022-09-09 2022-09-09 Method, device and equipment for supporting high-precision clock service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211104361.1A CN115632736A (en) 2022-09-09 2022-09-09 Method, device and equipment for supporting high-precision clock service

Publications (1)

Publication Number Publication Date
CN115632736A true CN115632736A (en) 2023-01-20

Family

ID=84903341

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211104361.1A Pending CN115632736A (en) 2022-09-09 2022-09-09 Method, device and equipment for supporting high-precision clock service

Country Status (1)

Country Link
CN (1) CN115632736A (en)

Similar Documents

Publication Publication Date Title
EP2469765B1 (en) Method and system for implementing time synchronization in local area network (lan)
KR101426325B1 (en) Network element for a packet-switched network
CN102195735B (en) Time synchronization method for multi-subsystem equipment and subsystem
WO2018082665A1 (en) Frequency synchronization method and slave clock
CN102447553A (en) Realizing device of accurate time synchronization protocol
WO2012071910A1 (en) Method and device for achieving time synchronization
CN102195766A (en) Time synchronization method and clock device
CN111385048A (en) Time synchronization method and system
CN112929117B (en) Compatible definable deterministic communication Ethernet
Cena et al. Synchronize your watches: Part II: Special-purpose solutions for distributed real-time control
CN102342051B (en) For coming the method for synchronised clock and relevant system and module by separating transmission first and second data via at least one time distribution protocol
CN104836654B (en) A kind of clock synchronizing method based on Ethernet POWERLINK
WO2021233313A1 (en) Port state configuration method, apparatus, system, and storage medium
EP2458757B1 (en) A method for transmitting IEEE 1588V2 synchronization packets over ethernet in link-by-link mode, via network elements having a transparent clock, and associated help device
CN115632736A (en) Method, device and equipment for supporting high-precision clock service
CN101420281A (en) Be used between network element, transmitting the method and apparatus of time value in a few days
CN116346272A (en) IEEE802.1AS clock synchronization system based on cooperation of PS end and PL end of Xilinx
US20230300068A1 (en) Synchronization in Distributed Communication Systems
CN214627023U (en) Switching equipment compatible with definable deterministic communication Ethernet
CN214480655U (en) Embedded equipment compatible with definable deterministic communication Ethernet
JP2023538335A (en) Clock synchronization mode instruction method and communication device
CN109347851B (en) Request response method and device
CN112583513A (en) Cloud platform clock time service method and system
Rodrigues et al. Synchronization in time-sensitive networking: An introduction to IEEE std 802.1 as
US11824925B1 (en) Node-to-node network time synchronization

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