CN104092528B - A kind of clock synchronizing method and device - Google Patents

A kind of clock synchronizing method and device Download PDF

Info

Publication number
CN104092528B
CN104092528B CN201410333987.9A CN201410333987A CN104092528B CN 104092528 B CN104092528 B CN 104092528B CN 201410333987 A CN201410333987 A CN 201410333987A CN 104092528 B CN104092528 B CN 104092528B
Authority
CN
China
Prior art keywords
port
clock
equipment
node equipment
topology
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
Application number
CN201410333987.9A
Other languages
Chinese (zh)
Other versions
CN104092528A (en
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 CN201410333987.9A priority Critical patent/CN104092528B/en
Publication of CN104092528A publication Critical patent/CN104092528A/en
Application granted granted Critical
Publication of CN104092528B publication Critical patent/CN104092528B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Synchronisation In Digital Transmission Systems (AREA)
  • Small-Scale Networks (AREA)

Abstract

The present invention proposes a kind of clock synchronizing method, and methods described includes:Topology messages are sent according to default slow transmission frequency to other clock node equipment by both sides port respectively;The Topology messages that other clock node equipment send are received by both sides port respectively;Network topology table is built according to the Topology messages for receiving, the network topology table includes the priority vector of each port for sending Topology messages;Priority vector according to each port determines whether this equipment is optimal clock node equipment;If it is, issuing synchronised clock to other clock node equipment by master port;If not, determine master port in the port of both sides and from port according to network topology table, the renewal that the synchronised clock that optimal clock node equipment issues completes local clock is received by from port;The synchronised clock is transmitted to by next-hop node equipment by master port.By means of the invention it is possible to reduce the convergence time of port role calculating, increase the stability of system.

Description

A kind of clock synchronizing method and device
Technical field
The present invention relates to communication technical field, more particularly to a kind of clock synchronizing method and device.
Background technology
In a communication network, it is perhaps multiple services it is normal operation require each equipment of network clocking synchronization, i.e. whole network it Between time or difference on the frequency be maintained in rational error level.Network clocking synchronously includes time synchronized and Frequency Synchronization, institute Meaning time synchronized, refers to that the frequency and phase between signal are all consistent, i.e., the phase difference perseverance between signal is zero;The frequency Rate synchronization, refers to that certain strict particular kind of relationship is kept in frequency or phase between signal, and signal is in its corresponding effective wink Between with same Mean Speed occur, with ensure all devices in communication network all with identical speed run, i.e., between signal Keep constant phase difference.For example, refer to Fig. 1, if having two table Clock A and Clock B, if the two tables when Between be all consistent all the time, this state is exactly time synchronized;If the Time Inconsistency of the two tables, but would be kept for one Constant difference (Clock B always 6 hours more late than Clock A) such as in figure, this state is exactly Frequency Synchronization.
PTP (Precision Time Protocol, Precision Time Protocol) agreement is a kind of agreement of time synchronized, is used Precise synchronization between equipment, we will apply the network referred to as PTP domains of PTP protocol.Have in PTP domains and only have One synchronised clock, all devices in domain are all synchronous with clock holding.Node in PTP domains is referred to as clock node, and when The port that PTP protocol has been run on clock node is then referred to as PTP ports.In PTP domains, the clock node for issuing lock in time is referred to as Host node (Master Node), the clock on host node is referred to as master clock (Master Clock), issues synchronous on clock node The PTP ports of time are referred to as master port;And the clock node for receiving lock in time is then referred to as from node (Slave Node), from section The PTP ports that clock on point is then referred to as being received from clock (Slave Clock) lock in time are then referred to as from port (Slave Port)。
Fig. 2 is referred to, all of clock node all presses certain hierarchical organization together in PTP domains, during the reference in whole domain Between be exactly optimal clock (Grandmaster Clock, GM), the i.e. clock of highest level.By PTP protocol between each clock node The interaction of message, the time of optimal clock is most synchronized in whole PTP domains at last, therefore also referred to as clock source.When optimal Clock can be specified by the way that manual configuration is static, it is also possible to dynamic by BMC (Best Master Clock, best master clock) agreement State is elected, and the process that it is dynamically elected is as follows:
By optimal clock priority, time entrained in the Announce messages of interaction etc. between each clock node The information such as level, time precision, finally select optimal clock of the node as PTP domains, at the same time, the master between each node Principal and subordinate port from relation and each node also determines.By this process, one is established in whole PTP domains Loop free, full-mesh, and the spanning tree with optimal clock as root.Hereafter, host node can periodically send Announce messages to from Node, if within a period of time, the Announce messages that host node is sent are not received from node, just thinks that the host node loses Effect, then re-starts the selection of optimal clock.
In PTP annular networkings, the link between equipment breaks down or recovers, and can all trigger relevant device and use BMC Algorithm recalculates port role, and the information after transmission renewal step by step, the master by obtaining final stabilization after series of computation From relation, then time started synchronization.For example, referring to Fig. 3, it is assumed that C0 is optimal clock, the path of C0 to C3 locks in time It is C0-C5-C4-C3, when the link failure between C0 and C5, triggering BMC algorithms recalculate port angle after C5 detects failure Color, sends the Announce messages of renewal.Similarly, C4 is received and also trigger BMC algorithms after the message and recalculate port role, is sent out To C3, C3 selects new Slave port-for-ports 32 to the Announce messages gone out after updating, and beginning is from C2 locks in time.This When C0 to C3 it is new lock in time path be C0-C1-C2-C3.
However, for PTP annular networkings, because the time synchronized path that link failure or recovery cause is restrained generally again More time is needed, it is necessary to notify failure and again one by one especially in the case that the equipment in looped network is more Port role is calculated, therefore time synchronized will interrupt longer time, consequently, it is possible to the time irreversibility between causing equipment.
The content of the invention
In view of this, the present invention proposes a kind of clock synchronizing method, and the clock synchronization compliant with precision time protocol node being applied in annular networking sets Standby, methods described includes:
Topology is sent by both sides port according to default slow transmission frequency to other clock node equipment respectively to report Text;
The Topology messages that described other clock node equipment send are received by both sides port respectively;
Network topology table is built according to the Topology messages for receiving, the network topology table includes sending described The priority vector of each port of Topology messages;
Priority vector according to each port determines whether this equipment is optimal clock node equipment;
If it is, issuing synchronised clock to other clock node equipment by master port;
If not, determine master port in the both sides port and from port according to the network topology table, by from end Mouth receives the renewal of the synchronised clock completion local clock of the optimal clock node equipment issue;Will be described same by master port Step clock-forwarding gives next-hop node equipment.
Preferably, the priority vector includes some subvectors arranged according to preset order;
The priority vector of other each ports described in the basis determines whether this equipment is optimal clock node equipment bag Include:
Each subvector in priority vector by the both sides port of this equipment with other each ports is according to described pre- Whether it is optimal vector with the priority vector for determining this equipment if order is compared successively;
If it is, this equipment is optimal clock node equipment;
If it is not, then this equipment is not optimal clock node equipment.
Preferably, the Topology messages include original hop count, current hop count and neighbor device mode field;It is described Neighbor device mode field includes the port status of the east orientation of the sending port of the Topology messages and west to port;
The Topology messages that the basis is received build network topology table to be included:
Difference according to the original hop count and the current hop count confirms the hop count with other clock node equipment;
The port status of the east orientation and west to port are confirmed according to the neighbor device mode field;
The Topology messages are distinguished in looped network in the port that the Topology messages are received according to this equipment Sending direction.
Preferably, methods described also includes:
When the current hop count is 0 or the Topology messages that receive are the Topology messages that this equipment sends, stop The Topology messages are only transmitted to by next-hop node equipment by the master port.
Preferably, it is described that master port in the both sides port is determined and from port bag according to the network topology table Include:
It is respectively compared the hop count of the both sides port and the optimal clock node equipment;
Selection is from port with the less port of hop count of the optimal clock node equipment;Another is master port.
Preferably, it is described master port in the both sides port to be determined according to the network topology table and is also wrapped from port Include:
When the both sides port is identical with the hop count of the optimal clock node equipment, respectively by the both sides port Each subvector in the priority vector of upstream sending port is compared successively according to the preset order;
Clock node equipment where the selection more excellent upstream sending port of priority vector as upstream clock source device, The port for connecting the equipment is from port;Another is master port.
Preferably, methods described also includes:
When link failure is detected, send described according to quick transmission frequency from another side ports of faulty link immediately Topology messages, to cause that other clock nodes are carried out after receiving the Topology messages to the local network topology table Update and redefine master port in the both sides port and from port;Wherein, the quick transmission frequency is more than described pre- If slow transmission frequency.
The present invention also proposes a kind of clock synchronization apparatus, is applied to the clock synchronization compliant with precision time protocol node device in annular networking, the dress Put including:
Sending module, for being sent out according to default slow transmission frequency to other clock node equipment respectively by both sides port Send Topology messages;
Receiver module, for receiving the Topology reports that described other clock node equipment send respectively by both sides port Text;
Module is built, for building network topology table according to the Topology messages for receiving, in the network topology table Priority vector including sending each port of the Topology messages;
Determining module, for determining whether this equipment is that optimal clock node sets according to the priority vector of each port It is standby;If it is, issuing synchronised clock to other clock node equipment by master port;If not, according to the network topology table Determine master port in the both sides port and from port, it is same by receive that the optimal clock node equipment issues from port Step clock completes the renewal of local clock;The synchronised clock is transmitted to by next-hop node equipment by master port.
Preferably, the priority vector includes some subvectors arranged according to preset order;
The determining module is further used for:
Each subvector in priority vector by the both sides port of this equipment with other each ports is according to described pre- Whether it is optimal vector with the priority vector for determining this equipment if order is compared successively;
If it is, this equipment is optimal clock node equipment;
If it is not, then this equipment is not optimal clock node equipment.
Preferably, the Topology messages include original hop count, current hop count and neighbor device mode field;It is described Neighbor device mode field includes the port status of the east orientation of the sending port of the Topology messages and west to port;
The structure module is further used for:
Difference according to the original hop count and the current hop count confirms the hop count with other clock node equipment;
The port status of the east orientation and west to port are confirmed according to the neighbor device mode field;
The Topology messages are distinguished in looped network in the port that the Topology messages are received according to this equipment Sending direction.
Preferably, the determining module is further used for:
When in the current hop count be 0 or the Topology messages that receive are the Topology messages that this equipment sends, stop The Topology messages are only transmitted to by next-hop node equipment by the master port.
Preferably, the determining module is further used for:
It is respectively compared the hop count of the both sides port and the optimal clock node equipment;
Selection is from port with the less port of hop count of the optimal clock node equipment;Another is master port.
Preferably, the port priority of the Topology messages also sending port including the Topology messages;
The determining module is further used for:
When the both sides port is identical with the hop count of the optimal clock node equipment, respectively by the both sides port Each subvector in the priority vector of upstream sending port is compared successively according to the preset order;
Clock node equipment where the selection more excellent upstream sending port of priority vector as upstream clock source device, The port for connecting the equipment is from port;Another is master port.
Preferably, the sending module is further used for:
When link failure is detected, send described according to quick transmission frequency from another side ports of faulty link immediately Topology messages, to cause that other clock nodes are carried out after receiving the Topology messages to the local network topology table Update and redefine master port in the both sides port and from port;Wherein, the quick transmission frequency is more than described pre- If slow transmission frequency.
For existing program, the present invention is interacted with each other by between the clock node equipment in looped network Topology messages determine optimal clock and port role, no longer by interaction between the clock node equipment in looped network Announce messages and BMC port roles algorithm determine optimal clock and port role, due to Topology reports Text is based on hardware forwarding, it is possible to achieve nearly all equipment is received and processes the Topology messages simultaneously, so as to reduce The convergence time that port role is calculated, increased the stability of system.
Brief description of the drawings
Fig. 1 is time synchronized and Frequency Synchronization schematic diagram in the prior art;
Fig. 2 is fundamental clock node schematic diagram in the prior art;
Fig. 3 is PTP annular networkings figure in the prior art;
Fig. 4 is the clock synchronizing method flow chart shown in a kind of exemplary implementation method of the present invention;
Fig. 5 is the message format of the Topology messages shown in a kind of exemplary implementation method of the present invention;
Fig. 6 is the lattice of the edgeStatus fields of the Topology messages shown in a kind of exemplary implementation method of the present invention Formula;
Fig. 7 be a kind of exemplary implementation method of the present invention show message transmitting party in loop network to schematic diagram;
Fig. 8 is the signal of PTP port roles election in loop network shown in a kind of exemplary implementation method of the present invention Figure;
PTP port roles when Fig. 9 is the loop network link failure shown in a kind of exemplary implementation method of the present invention The schematic diagram of election;
Figure 10 is the structural representation of the clock synchronization apparatus shown in a kind of exemplary implementation method of the present invention;
Figure 11 is the carrying clock synchronization apparatus clock synchronization compliant with precision time protocol node shown in a kind of exemplary implementation method of the present invention The hardware architecture diagram of equipment.
Specific embodiment
The present invention sends Topology messages respectively by the both sides port of the clock node equipment from looped network, and according to connecing The Topology messages that other clock node equipment in the looped network for receiving send construct ring-network topology, and then basis is constructed The ring-network topology determine the optimal clock in looped network and the port role in the both sides port;Due in the present invention In, optimal clock is no longer determined by interaction Announce messages and BMC port roles algorithm between clock node equipment And port role, the Topology messages are based on hardware forwarding, it is possible to achieve nearly all equipment is received and processed simultaneously The Topology messages, therefore the convergence time of port role calculating can be reduced, increase the stability of system.
Develop simultaneously embodiment below in conjunction with the accompanying drawings, and the present invention will be described in detail.
Fig. 4 is referred to, Fig. 4 is a kind of clock synchronizing method according to an exemplary embodiment, is applied to circular groups Clock synchronization compliant with precision time protocol node device in net, methods described performs following steps:
Step S401, sent according to default slow transmission frequency to other clock node equipment respectively by both sides port Topology messages;
Step S402, the Topology messages for receiving other clock node equipment transmission respectively by both sides port;
The Topology messages that step S403, basis are received build network topology table, and the network topology table includes Send the priority vector of each port of the Topology messages;
Step S404, determine whether this equipment is optimal clock node equipment according to the priority vector of each port; If it is, issuing synchronised clock to other clock node equipment by master port;If not, being determined according to the network topology table Master port in the both sides port and from port, during by receiving the synchronization that the optimal clock node equipment is issued from port Clock completes the renewal of local clock, and the synchronised clock is transmitted into next-hop node equipment by master port.
In the present embodiment, it is compatible existing PTP protocol, the Announce messages in PTP protocol can be transformed, Introduced in reserved field after new available fields as the Topology messages;
Specifically, the message format that 5, Fig. 5 is Topology messages is referred to, in the message lattice of the Announce messages Herein below is introduced on the basis of formula:
First, introducing a new value 0x04 in type of message messageType fields in message header, representing should Message is Topology messages.
Second, the reserved byte 64,65 of message is respectively defined as into ttl and ttlBase fields, the ttl fields take Value represents current hop count, and the value of the ttlBase fields represents original hop count;The Topology messages often set by one The value of standby ttl fields subtracts 1, and the value of the ttlBase fields keeps constant.Wherein, ttl fields and ttlBase fields Initial value, can specifically be set according to the quantity of equipment in actual networking, for example, can by the ttl fields and The initial value of ttlBase fields is disposed as 255.
Third, the reserved byte 66 of message is defined as into edgeStatus fields, i.e. neighbor device mode field.Refer to Fig. 6, Fig. 6 are the specific form of edgeStatus fields, the esw fields (edge state, west) and the ese fields (edge state, east) represents the west of the sending port of the current Topology messages to port and east orientation port respectively Port status, when implementing, failure are represented when can be 1 by the field value, and value represents normal when being 0.
Wherein, Fig. 6 is referred to, the west is to referring to the clockwise direction in looped network;The east orientation, in referring to looped network Counterclockwise.The west of the sending port of the Topology messages represents the transmitting terminal respectively to port and east orientation port The next port of mouth clockwise and counterclockwise in looped network.For example, as shown in fig. 7, if port 1 is described The sending port of Topology messages, then port 2 is the east orientation port of the port 1;Port 8 is then the west of port 1 to end Mouthful.
What deserves to be explained is, in the Topology messages in addition to the new above content for introducing, other fields it is specific Implication is identical with the concrete meaning in the Announce messages.
In the present embodiment, completed when the Topology messages build, the clock node equipment passes through both sides port To other clock node equipment the Topology messages are sent according to default slow transmission frequency.The both sides port, refer to Equipment is to east orientation in looped network and west to the port for sending message respectively;For example, as shown in fig. 7, for C0 equipment, it passes through Port 1 and 8 respectively to the east orientation in looped network and west to sending message respectively, therefore port 1 and 8 is the two side ends of the C0 Mouthful.
In the present embodiment, the Topology messages include the priority vector of the message source mouthful;Wherein, institute Stating priority vector includes some subvectors arranged according to preset order, and those subvectors are used to determine whether this equipment is most Excellent clock node equipment.When implementing, the existing parameter carried in the Topology messages can be selected as described Subvector, it is also possible to do not use the existing parameter in Topology messages individually to be specified.
For example, in a kind of preferred scheme, the priority vector can be according to the order in Topology messages Arranged, including Priority1 in the Topology messages, ClockQuality, Priority2, ClockId, The combination of SrcPortId and the isoparametric subvectors of RcvPortIndex individually specified.Wherein, PTP protocol regulation Priority1 and Priority2 are referred to as the priority facility of the sending port of Topology messages;SrcPortId is The port id of the sending port of Topology messages, is calculated by the MAC Address of the port, (is joined in detail with uniqueness IEEE802.1AS-2011);ClockQuality is Clock properties, and ClockId is clock ID;RcvPortIndex is The port index numbering of Topology message sinks mouthful, for being made a distinction with the SrcPortId.
Further, the clock node equipment can be pressed when the Topology messages are sent according to network condition It is transmitted according to different transmission frequency;For example, in the case of network stabilization, the clock node equipment can be according to described Default slow transmission frequency sends the Topology messages, can now be referred to as slow transmission pattern;When equipment detection During link failure, then quick sending mode is enabled immediately, another side ports from faulty link are according to more than the slow transmission The quick transmission frequency of frequency sends the Topology messages.
Wherein, the specific value size of the default slow transmission frequency and the quick transmission frequency is in the present embodiment It is not particularly limited, those skilled in the art can specifically be set according to actual network state;For example, can by institute Default slow transmission frequency default setting is stated for 100ms, is 10ms by the quick transmission frequency default setting.
Meanwhile, the clock node equipment by both sides port collect looped network in other clock node equipment send it is described Topology messages.The Topology message hardwares that the both sides port will receive forward and simultaneously on when giving described The control plane of clock node device is processed.
On the one hand, when the Topology messages that the clock node equipment sends other clock node equipment in looped network are received After the completion of collection, can be according to ttl the and ttlBase fields carried in each Topology messages, and edgeStatus field (neighbours Mode field) value generate the network topology table of current looped network.
Specifically, can be calculated by the way that the value of ttl and ttlBase fields in the Topology messages that receive of calculating is poor Hop count between the port and the port for sending the Topology messages;Can be according in the Topology messages for receiving The specific value of edgeStatus fields come confirm the port east orientation and west to port port status;Can also be according to this The port (i.e. RcvPortIndex) of the Topology messages is received in equipment to distinguish the Topology messages in ring Sending direction in net.When implementing, the priority vector can also be corresponded in the network topology table of write-in generation.
On the other hand, when the Topology messages that the clock node equipment sends other clock node equipment in looped network After the completion of collection, can also determine whether this equipment is optimal clock according to the priority vector carried in each Topology messages Node device.
Specifically, can one by one be compared according to the preset order of each subvector in the priority vector, come true Whether the priority vector for recognizing this equipment is optimal vector in looped network, if it is, this equipment is optimal clock node;Conversely, It is not then.
For example, it is assumed that priority vector include Priority1, ClockQuality, Priority2, ClockId, SrcPortId and RcvPortIndex, it is determined that during optimal vector, can be one by one compared according to preset order, when appointing Then it is optimal vector when one subvector is smaller;If identical, continue more next according to the order, until confirming Optimal vector.
Wherein, the value of ttl fields is 0 or receives in this equipment either port receives Topology messages When Topology messages are the Topology messages that this equipment sends, then stop reporting the Topology by the master port Text is transmitted to next-hop node equipment.
When it is optimal clock node equipment finally to confirm this equipment, now both sides port is defaulted as master port, this Clock in equipment is the optimal clock in looped network, and this equipment is issued by master port to other clock node equipment in looped network Synchronised clock, to cause that other clock node equipment complete the renewal of local clock according to the synchronised clock for receiving.It is logical The concrete methods of realizing that master port issues the optimal clock to other clock node equipment in looped network is crossed, existing skill is refer to Art, is no longer described in detail in the application.
When it is not optimal clock node equipment finally to confirm this equipment, then this equipment also needs to be completed according to structure Network topology table locally carrying out master port and election from port.
Specifically, be respectively compared east orientation of this equipment in looped network and west to port (i.e. described both sides port) with it is optimal when Hop count between clock node device, the selection port minimum with the hop count of optimal clock node equipment as from port, another It is master port;Wherein, if it is to disconnect that looped network has a sidelinks, another side ports for directly selecting disconnecting link are from end Mouthful.
When the east orientation and west identical to the hop count between port and optimal clock node equipment, then can further by The east orientation and west to each subvector in the priority vector of the upstream sending port of port according to the preset order successively It is compared, to confirm upstream clock source device.
Specifically, it is assumed that priority vector include Priority1, ClockQuality, Priority2, ClockId, SrcPortId and RcvPortIndex, can first compare Topology and report according to the default sequence of above-mentioned priority vector The port priority Priority1 of the upstream sending port of text, setting where the selection less upstream sending ports of Priority1 For as upstream clock source device, the port of locality connection upstream clock source device is that, from port, another is master port;When Priority1 is identical, then compares ClockQuality, the equipment where the selection less upstream sending ports of ClockQuality Used as upstream clock source device, the port of locality connection upstream clock source device is that, from port, another is master port;Class successively Push away, until electing upstream clock source device untill.
Wherein, because PTP protocol specifies, SrcPortId values have in the Topology messages that different ports sends Uniqueness (is generated) by port mac address computation, therefore when upstream clock source device is elected using the above method, is not in The unsuccessful problem of election caused because each subvector value for comparing is consistent.
In the present embodiment, when equipment detects link failure, quick sending mode is enabled immediately, immediately from failure two Another side ports on road send Topology messages according to the quick transmission frequency, to cause other clock nodes in looped network Equipment to receive be updated local network topology table after the Topology messages carries out master port and the election from port;By Forwarded based on hardware in Topology messages, this fast notification mechanism can be allowed within the extremely short time to be owned on looped network Equipment synchronously elects new port role, restarts PTP time synchronizeds.
Below by way of a specific application example, above-mentioned technical proposal is further described.
Refer to Fig. 8, Fig. 8 is a networking diagram for looped network, including six node devices of C0~C5.As shown in Figure 8 Carried out in looped network clock synchronization compliant with precision time protocol it is synchronous when, each node device in the looped network by both sides port respectively to the east orientation in looped network and West is to transmission Topology messages.For example, for node device C0, by port 01 and 02 respectively to the east orientation in looped network With west to transmission Topology messages.
Each node device collects the Topology messages of other node devices transmission in looped network, after the completion of collection, according to The Topology messages being collected into are come the election that builds network topology table and carry out optimal clock node.For example, being set for C1 For standby, by processing the Topology messages that both sides port in looped network receives, the topology table on looped network for finally calculating is such as Under:
Wherein, each subvector in upper table in priority vector, except RcvPortIndex is all from Topology messages The information of middle carrying.
When carrying out optimal clock node and electing, every node device can be to the Topology messages that are sent on the port of both sides Each subvector in the priority vector of middle carrying, after being compared successively according to preset order, confirms optimal vector.For example, For C1 equipment, can by each subvector Priority1 in the priority vector of local port, ClockQuality, Priority2, ClockId, SrcPortId and RcvPortIndex, are compared one by one according to preset order, when any son Then it is optimal vector when vector is smaller;If identical, continue more next according to the order, it is optimal until confirming Vector.If the priority vector of C1 local ports is optimal vector, then C1 equipment is optimal clock node (C1 local sides The priority vector of any one port is optimal vector in mouth 11 and port 1, and C1 equipment is optimal clock node).
After optimal clock node in confirming looped network, other node devices are then opened up according to the network for having been built up completing Flutterring table carries out the master port of local port and the election from port.It is assumed that C0 equipment is optimal clock node equipment in the looped network, Now two ports in C0 equipment are master port;Now C1~C5 equipment needs to be entered according to the local network topology table for building Row master port and the election from port.
Specifically, by taking C1 equipment as an example, C1 equipment compares local east orientation first and west sets to port with optimal clock node Hop count between standby, select the east orientation and it is western to port minimum with the optimal clock node hop count in port as from end Mouthful, another is master port.As shown in fig. 7, the hop count between the port 11 of C1 equipment and optimal clock node is minimum, then end Mouth 11 is that, from port, port 12 is then master port.
Assuming that the optimal clock of optimal clock node equipment is C4 in current looped network, then the now He of port 11 of C1 equipment Hop count between port 12 and C4 equipment is identical, when hop count is identical, then further by the port 11 of C1 equipment and port 12 Each subvector in the priority vector of upstream sending port is compared successively according to the preset order, to confirm that C1 sets Standby upstream clock source device.
Specifically, the upstream port of port 11 is the port 21 of C2 equipment, the port of the upstream port C0 equipment of port 12 01, when port 11 and port 12 will receive the Topology message up sending sent from the port 21 and port 01 to control Behind preparative layer face, the Priority1 in message can be compared, ClockQuality is compared again when Priority1 is identical, when ClockQuality is identical to compare Priority2 again, the like, where selecting the less port of subvector value Used as upstream clock source device, the port for connecting upstream clock source device is that, from port, another is master port to equipment.
When the generation link failure in looped network, for example, see Fig. 9, now link failure, C0 and C1 between C0 and C1 equipment Equipment starts quick sending mode from another side ports 02 of faulty link and port 12 respectively, is sent out to other node devices in looped network Topology messages are sent, after other node devices receive the Topology messages, is re-started according to the method described above again local The election of the port role of port simultaneously updates local network topology table.
In sum, the present invention is by interacting with each other Topology messages come really between the clock node equipment in looped network Fixed optimal clock and port role, between the clock node equipment in looped network no longer by interaction Announce messages and BMC port roles algorithm determines optimal clock and port role, because the Topology messages are forwarded based on hardware, and It is not based on being calculated by software and being forwarded for hop-by-hop, it is possible to achieve nearly all equipment is received and processes described simultaneously Topology messages, so as to reduce the convergence time of port role calculating, increased the stability of system.
Figure 10 is referred to, the present invention also proposes a kind of clock synchronization apparatus 100, is applied to the clock synchronization compliant with precision time protocol in annular networking Node device, wherein, refer to Figure 11, as the clock synchronization compliant with precision time protocol node device for carrying the clock synchronization apparatus 100 be related to it is hard In part framework, CPU, internal memory, nonvolatile memory, network interface and internal bus etc. are generally included.It is implemented in software to be Example, apparatus of the present invention 100 are it is generally understood that the computer program being carried in internal memory, is formed after being run by CPU The logic device that software and hardware is combined;Described device 100 includes:
Sending module 1001, for by both sides port respectively to other clock node equipment according to default slow transmission frequently Rate sends Topology messages;
Receiver module 1002, for receiving what described other clock node equipment sent respectively by both sides port Topology messages;
Module 1003 is built, for building network topology table, the network topology according to the Topology messages for receiving Table includes the priority vector of each port for sending the Topology messages;
Determining module 1004, for determining whether this equipment is optimal clock section according to the priority vector of each port Point device;If it is, issuing synchronised clock to other clock node equipment by master port;If not, being opened up according to the network Flutter master port that table determined in the both sides port and from port, issued by receiving the optimal clock node equipment from port Synchronised clock complete local clock renewal;The synchronised clock is transmitted to by next-hop node equipment by master port.
In the present embodiment, the priority vector includes some subvectors arranged according to preset order;
The determining module 1004 is further used for:
Each subvector in priority vector by the both sides port of this equipment with other each ports is according to described pre- Whether it is optimal vector with the priority vector for determining this equipment if order is compared successively;
If it is, this equipment is optimal clock node equipment;
If it is not, then this equipment is not optimal clock node equipment.
In the present embodiment, the Topology messages include original hop count, current hop count and neighbor device status word Section;The neighbor device mode field includes the port shape of the east orientation of the sending port of the Topology messages and west to port State;
The structure module 1003 is further used for:
Difference according to the original hop count and the current hop count confirms the hop count with other clock node equipment;
The port status of the east orientation and west to port are confirmed according to the neighbor device mode field;
The Topology messages are distinguished in looped network in the port that the Topology messages are received according to this equipment Sending direction.
In the present embodiment, the determining module 1004 is further used for:
When in the current hop count be 0 or the Topology messages that receive are the Topology messages that this equipment sends, stop The Topology messages are only transmitted to by next-hop node equipment by the master port.
In the present embodiment, the determining module 1004 is further used for:
It is respectively compared the hop count of the both sides port and the optimal clock node equipment;
Selection is from port with the less port of hop count of the optimal clock node equipment;Another is master port.
In the present embodiment, the Port Priority of the Topology messages also sending port including the Topology messages Level;
The determining module 1004 is further used for:
When the both sides port is identical with the hop count of the optimal clock node equipment, respectively by the both sides port Each subvector in the priority vector of upstream sending port is compared successively according to the preset order;
Clock node equipment where the selection more excellent upstream sending port of priority vector as upstream clock source device, The port for connecting the equipment is from port;Another is master port.
In the present embodiment, the sending module 1001 is further used for:
When link failure is detected, send described according to quick transmission frequency from another side ports of faulty link immediately Topology messages, to cause that other clock nodes are carried out after receiving the Topology messages to the local network topology table Update and redefine master port in the both sides port and from port;Wherein, the quick transmission frequency is more than described pre- If slow transmission frequency.
It will be appreciated by those skilled in the art that the unit in device in embodiment can be distributed according to embodiment description In the device of embodiment, it is also possible to carry out respective change and be disposed other than in one or more devices of the present embodiment.Above-mentioned reality Applying the unit of example can merge into a unit, can also be further split into multiple submodule.Foregoing invention embodiment sequence number is only Only for description, the quality of embodiment is not represented.
Presently preferred embodiments of the present invention is the foregoing is only, is not intended to limit the invention, it is all in essence of the invention Within god and principle, any modification, equivalent substitution and improvements done etc. should be included within the scope of protection of the invention.

Claims (14)

1. a kind of clock synchronizing method, is applied to the clock synchronization compliant with precision time protocol node device in annular networking, it is characterised in that methods described Including:
Topology messages are sent according to default slow transmission frequency to other clock node equipment by both sides port respectively;
The Topology messages that described other clock node equipment send are received by both sides port respectively;
Network topology table is built according to the Topology messages for receiving, the network topology table includes sending described The priority vector of each port of Topology messages;
Priority vector according to each port determines whether this equipment is optimal clock node equipment;
If it is, issuing synchronised clock to other clock node equipment by master port;
If not, determining master port in the both sides port and from port according to the network topology table, connect by from port The synchronised clock for receiving the optimal clock node equipment issue completes the renewal of local clock;When will be described synchronous by master port Clock is transmitted to next-hop node equipment.
2. the method for claim 1, it is characterised in that the priority vector includes some being arranged according to preset order Subvector;
The priority vector according to each port determines whether this equipment is that optimal clock node equipment includes:
Each subvector in priority vector by the both sides port of this equipment with each port according to the preset order according to It is secondary to be compared, whether it is optimal vector with the priority vector for determining this equipment;
If it is, this equipment is optimal clock node equipment;
If it is not, then this equipment is not optimal clock node equipment.
3. the method for claim 1, it is characterised in that
The Topology messages include original hop count, current hop count and neighbor device mode field;The neighbor device shape State field includes the port status of the east orientation of the sending port of the Topology messages and west to port;
The Topology messages that the basis is received build network topology table to be included:
Difference according to the original hop count and the current hop count confirms the hop count with other clock node equipment;
The port status of the east orientation and west to port are confirmed according to the neighbor device mode field;
Transmission of the Topology messages in looped network is distinguished according to the port that this equipment receives the Topology messages Direction.
4. method as claimed in claim 3, it is characterised in that methods described also includes:
When the current hop count is 0 or the Topology messages that receive are the Topology messages that this equipment sends, stop logical Cross the master port and the Topology messages are transmitted to next-hop node equipment.
5. method as claimed in claim 2, it is characterised in that described that the two side ends are determined according to the network topology table Mouthful in master port and include from port:
It is respectively compared the hop count of the both sides port and the optimal clock node equipment;
Selection is from port with the less port of hop count of the optimal clock node equipment;Another is master port.
6. method as claimed in claim 5, it is characterised in that described that the two side ends are determined according to the network topology table Mouthful in master port and also include from port:
When the both sides port is identical with the hop count of the optimal clock node equipment, respectively by the upstream of the both sides port Each subvector in the priority vector of sending port is compared successively according to the preset order;
Clock node equipment where the more excellent upstream sending port of selection priority vector is used as upstream clock source device, connection The port of the equipment is from port;Another is master port.
7. the method for claim 1, it is characterised in that methods described also includes:
When link failure is detected, send described according to quick transmission frequency from another side ports of faulty link immediately Topology messages, to cause that other clock nodes are carried out after receiving the Topology messages to the local network topology table Update and redefine master port in the both sides port and from port;
Wherein, the quick transmission frequency is more than the default slow transmission frequency.
8. a kind of clock synchronization apparatus, are applied to the clock synchronization compliant with precision time protocol node device in annular networking, it is characterised in that described device Including:
Sending module, for being sent according to default slow transmission frequency to other clock node equipment respectively by both sides port Topology messages;
Receiver module, for receiving the Topology messages that described other clock node equipment send respectively by both sides port;
Module is built, for building network topology table according to the Topology messages for receiving, the network topology table includes Send the priority vector of each port of the Topology messages;
Determining module, for determining whether this equipment is optimal clock node equipment according to the priority vector of each port; If it is, issuing synchronised clock to other clock node equipment by master port;If not, being determined according to the network topology table Master port in the both sides port and from port, during by receiving the synchronization that the optimal clock node equipment is issued from port Clock completes the renewal of local clock;The synchronised clock is transmitted to by next-hop node equipment by master port.
9. device as claimed in claim 8, it is characterised in that the priority vector includes some being arranged according to preset order Subvector;
The determining module is further used for:
Each subvector in priority vector by the both sides port of this equipment with each port according to the preset order according to It is secondary to be compared, whether it is optimal vector with the priority vector for determining this equipment;
If it is, this equipment is optimal clock node equipment;
If it is not, then this equipment is not optimal clock node equipment.
10. device as claimed in claim 8, it is characterised in that the Topology messages include original hop count, current hop count And neighbor device mode field;The neighbor device mode field includes the east orientation of the sending port of the Topology messages With port status from west to port;
The structure module is further used for:
Difference according to the original hop count and the current hop count confirms the hop count with other clock node equipment;
The port status of the east orientation and west to port are confirmed according to the neighbor device mode field;
Transmission of the Topology messages in looped network is distinguished according to the port that this equipment receives the Topology messages Direction.
11. devices as claimed in claim 10, it is characterised in that the determining module is further used for:
When in the current hop count be 0 or the Topology messages that receive are the Topology messages that this equipment sends, stop logical Cross the master port and the Topology messages are transmitted to next-hop node equipment.
12. devices as claimed in claim 9, it is characterised in that the determining module is further used for:
It is respectively compared the hop count of the both sides port and the optimal clock node equipment;
Selection is from port with the less port of hop count of the optimal clock node equipment;Another is master port.
13. devices as claimed in claim 12, it is characterised in that the determining module is further used for:
When the both sides port is identical with the hop count of the optimal clock node equipment, respectively by the upstream of the both sides port Each subvector in the priority vector of sending port is compared successively according to the preset order;
Clock node equipment where the more excellent upstream sending port of selection priority vector is used as upstream clock source device, connection The port of the equipment is from port;Another is master port.
14. devices as claimed in claim 8, it is characterised in that the sending module is further used for:
When link failure is detected, send described according to quick transmission frequency from another side ports of faulty link immediately Topology messages, to cause that other clock nodes are carried out after receiving the Topology messages to the local network topology table Update and redefine master port in the both sides port and from port;Wherein, the quick transmission frequency is more than described pre- If slow transmission frequency.
CN201410333987.9A 2014-07-14 2014-07-14 A kind of clock synchronizing method and device Active CN104092528B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410333987.9A CN104092528B (en) 2014-07-14 2014-07-14 A kind of clock synchronizing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410333987.9A CN104092528B (en) 2014-07-14 2014-07-14 A kind of clock synchronizing method and device

Publications (2)

Publication Number Publication Date
CN104092528A CN104092528A (en) 2014-10-08
CN104092528B true CN104092528B (en) 2017-06-06

Family

ID=51640210

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410333987.9A Active CN104092528B (en) 2014-07-14 2014-07-14 A kind of clock synchronizing method and device

Country Status (1)

Country Link
CN (1) CN104092528B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106301647B (en) * 2015-06-05 2019-04-19 中兴通讯股份有限公司 A kind of method and device for realizing alternately BMC
CN107204928B (en) 2016-03-18 2021-06-08 华为技术有限公司 Method for updating clock synchronization topology, method and equipment for determining clock synchronization path
US10530560B2 (en) * 2016-06-20 2020-01-07 Nxp B.V. Integrated circuit and method for processing synchronized network frames using a hardware synchronization circuit
CN108988973A (en) * 2017-06-05 2018-12-11 中兴通讯股份有限公司 Aggregated links clock control method and system
CN112152745B (en) * 2019-08-07 2021-09-28 中兴通讯股份有限公司 Time synchronization method, time synchronization sending end, time synchronization receiving end and time synchronization system
CN110958504A (en) * 2019-12-13 2020-04-03 中国电子科技集团公司第五十四研究所 High-stability high-reliability time frequency network implementation method based on optical fiber ring network architecture
CN116684024B (en) * 2023-05-31 2024-06-04 中国科学院空间应用工程与技术中心 FC-AE-1553 boundary clock port state configuration method and system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7280550B1 (en) * 2002-12-18 2007-10-09 Cirrus Logic, Inc. Bandwidth optimization of ring topology through propagation delay compensation
CN101170373A (en) * 2007-11-27 2008-04-30 上海自动化仪表股份有限公司 Clock synchronization realization method for loop network
CN101873243A (en) * 2010-06-21 2010-10-27 中兴通讯股份有限公司 Method and device for realizing coordinated time synchronization of 1588 message
CN102158335A (en) * 2011-04-21 2011-08-17 中兴通讯股份有限公司 Method and device for processing time synchronization port
CN102195766A (en) * 2010-03-01 2011-09-21 杭州华三通信技术有限公司 Time synchronization method and clock device
KR20120051632A (en) * 2012-05-08 2012-05-22 성균관대학교산학협력단 Method for clock synchronization in distributed system having ring topology and apparatus for the same
EP2645638A1 (en) * 2012-03-29 2013-10-02 Robert Bosch Gmbh Communication system with chain or ring topology
CN103428086A (en) * 2012-05-25 2013-12-04 北京东土科技股份有限公司 PTP protocol-based transparent clock passive port voting method and apparatus
CN103634208A (en) * 2013-11-26 2014-03-12 杭州华三通信技术有限公司 Method and device for preventing loop in PTP (precision time protocol) TC (transparent clock) looped network

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7280550B1 (en) * 2002-12-18 2007-10-09 Cirrus Logic, Inc. Bandwidth optimization of ring topology through propagation delay compensation
CN101170373A (en) * 2007-11-27 2008-04-30 上海自动化仪表股份有限公司 Clock synchronization realization method for loop network
CN102195766A (en) * 2010-03-01 2011-09-21 杭州华三通信技术有限公司 Time synchronization method and clock device
CN101873243A (en) * 2010-06-21 2010-10-27 中兴通讯股份有限公司 Method and device for realizing coordinated time synchronization of 1588 message
CN102158335A (en) * 2011-04-21 2011-08-17 中兴通讯股份有限公司 Method and device for processing time synchronization port
EP2645638A1 (en) * 2012-03-29 2013-10-02 Robert Bosch Gmbh Communication system with chain or ring topology
KR20120051632A (en) * 2012-05-08 2012-05-22 성균관대학교산학협력단 Method for clock synchronization in distributed system having ring topology and apparatus for the same
CN103428086A (en) * 2012-05-25 2013-12-04 北京东土科技股份有限公司 PTP protocol-based transparent clock passive port voting method and apparatus
CN103634208A (en) * 2013-11-26 2014-03-12 杭州华三通信技术有限公司 Method and device for preventing loop in PTP (precision time protocol) TC (transparent clock) looped network

Also Published As

Publication number Publication date
CN104092528A (en) 2014-10-08

Similar Documents

Publication Publication Date Title
CN104092528B (en) A kind of clock synchronizing method and device
EP3140932B1 (en) A method for robust ptp synchronization with default 1588v2 profile
CN103916950B (en) Method for synchronizing time and system
US9749073B2 (en) Clock recovery in a packet based network
CN101616163B (en) Method and device for processing precise time transfer protocol message
US8565270B2 (en) Phase and frequency re-lock in synchronous ethernet devices
CN103166750B (en) Synchronizing clock time source collocation method and device
CN102833061A (en) Method for improving clock accuracy based on seamless redundancy ring network and node
WO2021136049A1 (en) Multi-distributed network element clock transmission system
CN103684648B (en) A kind of ring network node clock effectiveness judgment method and device
CN103841025A (en) Communication system and network relay device
CN109155788A (en) The method of GM clock is quickly reconfigured in TSN network by clear tear down message
EP2852087A1 (en) Packet network synchronization method, apparatus and system
JP2019508986A (en) Method for updating clock synchronization topology, method and device for determining clock synchronization path
CN103595626A (en) Method for achieving dynamic path planning in ring network
WO2011088150A2 (en) Method for switching master/slave timing in a 1000base-t link without traffic disruption
WO2011140918A1 (en) Method and apparatus for topology discovery
EP2597821A1 (en) Method and system for auto-configuration, and network node
CN103490840B (en) A kind of apparatus and method for carrying out Precision Time Protocol Message processing
CN114826466A (en) Selection and switching method of redundant master clock
CN103634208A (en) Method and device for preventing loop in PTP (precision time protocol) TC (transparent clock) looped network
JP2009239450A (en) Route change type network device and system
CN115459870A (en) Time synchronization method, device, electronic equipment and storage medium
CN106533597B (en) A kind of selection method and network element node of time source
CN105099646A (en) Synchronization link determination method and apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No.

Applicant after: Xinhua three Technology Co., Ltd.

Address before: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No.

Applicant before: Huasan Communication Technology Co., Ltd.

GR01 Patent grant
GR01 Patent grant