A message forwarding method, device and system

By receiving messages from the second network device in the first network device, measuring the phase difference, considering link delay, and scheduling data packets, the problem of time synchronization difficulty and cost in the CQF mechanism based on time gating scheduling is solved, and the problem of time synchronization difficulty and cost is realized. Data packet forwarding without relying on time synchronization reduces the difficulty and cost of network deployment.

CN112583510BActive Publication Date: 2025-01-10HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN201911057482.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2019-09-30
Filing Date
2019-11-01
Publication Date
2025-01-10
Estimated Expiration
2039-11-01

AI Technical Summary

Technical Problem

The CQF mechanism based on time gating scheduling in IEEE 802.1Qbv and IEEE 802.1Qch relies on time synchronization, resulting in accurate time synchronization of devices across the network increasing the difficulty and cost of network deployment, and the accumulation of clock jitter in the communication link increases the difficulty of implementation.

Method used

The first network device receives the message sent by the second network device, measures the phase difference, considers the link delay, and schedules data packets, so as to realize the queueing and forwarding of data packets without relying on time synchronization.

Benefits of technology

It realizes that data packets between the first network device and the second network device are queued and forwarded without relying on time synchronization, reducing the difficulty and cost of network deployment, and avoiding the impact of clock jitter on synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112583510B_ABST
    Figure CN112583510B_ABST
Patent Text Reader

Abstract

A message forwarding method, device and system. The method includes: a first network device receives a first message sent by a second network device via a second output port of the second network device, the first message is used to measure a phase difference, and the phase difference is the phase difference between the switching time of a first cache among multiple first caches of the first output port of the first network device and the switching time of a second cache among multiple second caches of the second output port of the second network device, taking into account the link delay. And, the first network device determines the phase difference according to the first message. Then, the first network device schedules the second data message sent via the first output port according to the phase difference. Thereby, the first network device and the second network device realize the queuing and forwarding of data messages without relying on time synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a message forwarding method, device and system. Background Art

[0002] Audio video bridging (AVB) is a new Ethernet standard. AVB-related standards are developed by the AVB task group under the 802.1 working group of the Institute of Electrical and Electronics Engineers (IEEE). In 2012, the AVB task group was officially renamed the time-sensitive networking (TSN) task group. TSN mainly involves stream reservation protocol (SRP), precision time protocol (PTP) and traffic shaping. TSN can be used in network scenarios with low latency requirements or based on time-synchronous data transmission, such as audio and video transmission, automotive control, industrial control and commercial electronics.

[0003] TSN technical standards can be divided into four parts: data plane, control plane, time synchronization, and reliability. Among them, several scheduling algorithms and frame preemption mechanisms defined in the data plane are key technologies for TSN to achieve deterministic latency characteristics. Several scheduling algorithms can be divided into two categories: one is scheduling based on time gating (also known as synchronous scheduling), and the other is scheduling based on quality of service (QoS) (no need for time gating, also known as asynchronous scheduling). The work of the control plane is to reserve resources and other related configurations for network equipment according to the needs of TSN business flows, thereby supporting the work of the TSN data plane.

[0004] IEEE 802.1Qbv defines a basic mechanism based on time-gated scheduling. Based on Qbv, IEEE 802.1Qch further defines a mechanism based on cyclic queuing and forwarding (CQF): two or more caches need to be deployed on the egress port of each node for round-robin scheduling, and all nodes are time synchronized, so the time and frequency of cache rotation on the egress port of each node are the same.

[0005] The use of the CQF mechanism relies on the IEEE802.1AS time synchronization protocol, which is a specific design based on the precision time protocol (PTP) in IEEE 1588. Therefore, in the network scenario where the CQF mechanism is implemented, the precise time synchronization of all network devices increases the difficulty and cost of network deployment. In addition, the accumulation of clock jitter in the communication link increases the difficulty of implementing precise time synchronization. Summary of the invention

[0006] In view of this, an embodiment of the present application provides a message forwarding method, device and system, wherein a first network device determines a phase difference based on measurement information received from a second network device, wherein the phase difference is a phase difference between a switching time of a first cache among multiple first caches of a first output port of the first network device and a switching time of a second cache among multiple second caches of a second output port of the second network device, taking into account link delay, and the first network device schedules data messages that need to be sent via the first output port based on the phase difference, thereby enabling the first network device and the second network device to realize queuing and forwarding of data messages without relying on time synchronization.

[0007] The technical solutions provided in the embodiments of the present application are as follows.

[0008] In a first aspect, a message forwarding method is provided, the method comprising: a first network device receives a first message sent by a second network device via a second output port of the second network device, the first message is used to measure a phase difference, the phase difference is the phase difference between the switching time of a first cache among multiple first caches of the first output port of the first network device and the switching time of a second cache among multiple second caches of the second output port of the second network device, taking into account the link delay. Furthermore, the first network device determines the phase difference according to the first message, and the switching period of the multiple first caches is the same as the switching period of the multiple second caches. Then, the first network device schedules the second data message sent via the first output port according to the phase difference.

[0009] Based on the solution provided in the embodiment, the first network device and the second network device implement queuing and forwarding of data messages without relying on time synchronization.

[0010] In a possible implementation manner of the first aspect, before the first network device determines the phase difference according to the first message, the method also includes: the first network device receives a second message sent by the second network device, the second message includes a first time and a second time, the first time is the time when the second network device sends the first message, and the second time is a first switching time of the second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; the first network device determines the phase difference according to the first message, specifically including: the first network device determines the phase difference according to the first message and the second message.

[0011] Based on the solution provided in the embodiment, the first network device and the second network device transmit the first message and the second message to improve the calculation accuracy of the phase difference.

[0012] In another possible implementation of the first aspect, before the first network device determines the phase difference according to the first message, the method also includes: the first network device receives a second message sent by the second network device, the second message includes a first time difference, the first time difference is the difference between the first time and the second time, the first time is the time when the second network device sends the first message, the second time is the first switching time of the second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; the first network device determines the phase difference according to the first message, specifically including: the first network device determines the phase difference according to the first message and the second message.

[0013] Based on the solution provided in the embodiment, the first network device and the second network device transmit the first message and the second message to improve the calculation accuracy of the phase difference.

[0014] In another possible implementation of the first aspect, the first network device determines the phase difference according to the first message and the second message, including: the first network device determines a third time to receive the first message; the first network device determines a fourth time according to the third time, the fourth time being a second switching time of a first cache among the multiple first caches scheduled corresponding to when the first message is received, and the second switching time is later than the third time; the first network device determines the phase difference, the value of the phase difference being equal to the difference between the switching periods of the multiple first caches and a first value, wherein the first value is equal to the value modulo the switching periods of the multiple first caches by a second value, wherein the second value is equal to the sum of the difference between the first time and the second time and the difference between the fourth time and the third time.

[0015] Optionally, the first message includes a first time and a second time, the first time is the time when the second network device sends the first message, the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time.

[0016] Optionally, the first message includes a first time difference, which is the difference between a first time and a second time, the first time is the time when the second network device sends the first message, and the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time.

[0017] In another possible implementation of the first aspect, the first network device determines the phase difference according to the first message, including: the first network device determines a third time to receive the first message; the first network device determines a fourth time according to the third time, the fourth time being a second switching time of a first cache among the multiple first caches scheduled corresponding to when the first message is received, and the second switching time is later than the third time; the first network device determines the phase difference, the value of the phase difference being equal to the difference between the switching periods of the multiple first caches and a first value, wherein the first value is equal to the value of a second value modulo the switching periods of the multiple first caches, wherein the second value is equal to the sum of the difference between the first time and the second time and the difference between the fourth time and the third time.

[0018] In another possible implementation of the first aspect, the first network device schedules the second data packet to be sent via the first output port according to the phase difference, including: the first network device determines the first cache corresponding to the second data packet according to the phase difference and the processing delay, the multiple first caches include the corresponding first cache, and the processing delay is the delay generated in the process of the first network device determining the second data packet according to the first data packet; the first network device saves the second data packet in the corresponding first cache; within the first cycle after the second data packet is saved and the corresponding first cache is scheduled by the first network device, the first network device sends the second data packet via the first output port.

[0019] In a second aspect, a message forwarding method is provided, the method comprising: a second network device generates a first message, the first message is used to trigger the first network device to determine a phase difference, the phase difference is the phase difference between the switching time of one of the multiple first caches of the first egress port of the first network device and the switching time of one of the multiple second caches of the second egress port of the second network device, taking into account the link delay. Then, the second network device sends the first message to the first network device via the second egress port of the second network device, and the switching period of the multiple first caches is the same as the switching period of the multiple second caches.

[0020] Based on the solution provided in the embodiment, the first network device and the second network device implement queuing and forwarding of data messages without relying on time synchronization.

[0021] In a possible implementation of the second aspect, the method also includes: the second network device generates a second message, the second message includes a first time and a second time, the first time is the time when the second network device sends the first message, and the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; the second network device sends the second message to the first network device via the second output port of the second network device.

[0022] Based on the solution provided in the embodiment, the first network device and the second network device transmit the first message and the second message to improve the calculation accuracy of the phase difference.

[0023] In another possible implementation of the second aspect, the method also includes: the second network device generates a second message, the second message includes a first time difference, the first time difference is the difference between the first time and the second time, the first time is the time when the second network device sends the first message, the second time is the first switching time of the second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; the second network device sends the second message to the first network device via the second output port of the second network device.

[0024] Based on the solution provided in the embodiment, the first network device and the second network device transmit the first message and the second message to improve the calculation accuracy of the phase difference.

[0025] In the above-mentioned first aspect or second aspect, optionally, the first message includes a first identifier for identifying the first message, and the second message includes a second identifier for identifying the second message, and the first identifier corresponds to the second identifier.

[0026] In the above-mentioned first aspect or second aspect, optionally, the first message is a cyclic shift measurement message COMM.

[0027] In the above first aspect or second aspect, optionally, the second message is a cyclic offset follow message COFM.

[0028] In a third aspect, a first network device is provided, wherein the first network device has a function of implementing the first network device behavior in the above method. The function can be implemented based on hardware, or can be implemented based on hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above function.

[0029] In one possible design, the structure of the first network device includes a processor and an interface, and the processor is configured to support the first network device to perform the corresponding functions in the above method. The interface is used to support communication between the first network device and the second network device, and receive information or instructions involved in the above method from the second network device. The first network device may also include a memory, which is coupled to the processor and stores necessary program instructions and data for the first network device.

[0030] In another possible design, the first network device includes: a processor, a transmitter, a receiver, a random access memory, a read-only memory, and a bus. The processor is respectively coupled to the transmitter, the receiver, the random access memory, and the read-only memory through the bus. When the first network device needs to be run, it is started by the basic input / output system solidified in the read-only memory or the bootloader boot system in the embedded system to guide the first network device into a normal operating state. After the first network device enters the normal operating state, the application program and the operating system are run in the random access memory, so that the processor executes the method in the first aspect or any possible implementation of the first aspect.

[0031] In a fourth aspect, a first network device is provided, the first network device comprising: a main control board and an interface board, and further, a switching network board. The first network device is used to execute the method in the first aspect or any possible implementation of the first aspect. Specifically, the first network device comprises a module for executing the method in the first aspect or any possible implementation of the first aspect.

[0032] In a fifth aspect, a first network device is provided, the first network device comprising a controller and a first forwarding sub-device. The first forwarding sub-device comprises: an interface board, and further, may also comprise a switching network board. The first forwarding sub-device is used to perform the function of the interface board in the fourth aspect, and further, may also perform the function of the switching network board in the fourth aspect. The controller comprises a receiver, a processor, a transmitter, a random access memory, a read-only memory, and a bus. The processor is respectively coupled to the receiver, the transmitter, the random access memory, and the read-only memory through the bus. When the controller needs to be run, it is started by the basic input / output system solidified in the read-only memory or the bootloader boot system in the embedded system, and the controller is guided to enter a normal operating state. After the controller enters the normal operating state, the application program and the operating system are run in the random access memory, so that the processor performs the function of the main control board in the fourth aspect.

[0033] In a sixth aspect, a computer storage medium is provided for storing programs, codes or instructions used for the above-mentioned first network device. When a processor or hardware device executes these programs, codes or instructions, the functions or steps of the first network device in the above-mentioned first aspect can be completed.

[0034] In a seventh aspect, a second network device is provided, wherein the second network device has a function of implementing the second network device behavior in the above method. The function can be implemented based on hardware, or can be implemented based on hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0035] In one possible design, the structure of the second network device includes a processor and an interface, and the processor is configured to support the second network device to perform the corresponding functions in the above method. The interface is used to support communication between the second network device and the first network device, and send information or instructions involved in the above method to the first network device. The second network device may also include a memory, which is coupled to the processor and stores necessary program instructions and data for the second network device.

[0036] In another possible design, the second network device includes: a processor, a transmitter, a receiver, a random access memory, a read-only memory, and a bus. The processor is respectively coupled to the transmitter, the receiver, the random access memory, and the read-only memory through the bus. When the second network device needs to be run, it is started by the basic input / output system solidified in the read-only memory or the bootloader boot system in the embedded system to guide the second network device into a normal operating state. After the second network device enters the normal operating state, the application program and the operating system are run in the random access memory, so that the processor executes the method in the second aspect or any possible implementation of the second aspect.

[0037] In an eighth aspect, a second network device is provided, the second network device comprising: a main control board and an interface board, and further, a switching network board. The second network device is used to execute the method in the second aspect or any possible implementation of the second aspect. Specifically, the second network device includes a module for executing the method in the second aspect or any possible implementation of the second aspect.

[0038] In the ninth aspect, a second network device is provided, the second network device includes a controller and a second forwarding sub-device. The second forwarding sub-device includes: an interface board, and further, may also include a switching network board. The second forwarding sub-device is used to perform the function of the interface board in the eighth aspect, and further, may also perform the function of the switching network board in the eighth aspect. The controller includes a receiver, a processor, a transmitter, a random access memory, a read-only memory and a bus. Among them, the processor is respectively coupled to the receiver, the transmitter, the random access memory and the read-only memory through the bus. Among them, when it is necessary to run the controller, it is started by the basic input / output system solidified in the read-only memory or the bootloader boot system in the embedded system, and the controller is guided to enter a normal operating state. After the controller enters the normal operating state, the application program and the operating system are run in the random access memory, so that the processor performs the function of the main control board in the eighth aspect.

[0039] In the tenth aspect, a computer storage medium is provided for storing programs, codes or instructions used for the above-mentioned second network device. When the processor or hardware device executes these programs, codes or instructions, the functions or steps of the second network device in the above-mentioned second aspect can be completed.

[0040] In the eleventh aspect, a network system is provided, comprising a first network device and a second network device, wherein the first network device is the first network device in the third aspect, the fourth aspect, or the fifth aspect, and the second network device is the second network device in the seventh aspect, the eighth aspect, or the ninth aspect.

[0041] Through the above scheme, in the communication network, the first network device determines the phase difference according to the message received from the second network device, wherein the first network device considers the link delay between the second network device and the first network device when determining the phase difference. Further, the first network device can schedule the data message sent via the first output port of the first network device according to the phase difference. Thus, the first network device and the second network device realize the queuing and forwarding of data messages without relying on time synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A schematic diagram of a communication network structure according to an embodiment of the present application;

[0043] Figure 2 A schematic diagram of a message forwarding process according to an embodiment of the present application;

[0044] Figure 3 A schematic diagram of another message forwarding process according to an embodiment of the present application;

[0045] Figure 4 A flow chart of a message forwarding method according to an embodiment of the present application;

[0046] Figure 5 A schematic diagram of the structure of a first network device according to an embodiment of the present application;

[0047] Figure 6 A schematic diagram of the hardware structure of a first network device according to an embodiment of the present application;

[0048] Figure 7 A schematic diagram of the hardware structure of another first network device according to an embodiment of the present application;

[0049] Figure 8 A schematic diagram of the structure of a second network device according to an embodiment of the present application;

[0050] Fig. 9 A schematic diagram of the hardware structure of a second network device according to an embodiment of the present application;

[0051] Fig.10 A schematic diagram of the hardware structure of another second network device according to an embodiment of the present application. DETAILED DESCRIPTION

[0052] The following describes the embodiments in detail.

[0053] Figure 1 FIG. 1 is a schematic diagram of a communication network structure of an embodiment of the present application. Figure 1 The communication network includes a first network device and a second network device. In a possible implementation, the communication network is a time-sensitive networking (TSN) of a fully distributed model. For the network architecture of the TSN of the fully distributed model, reference can be made to the relevant explanations in "Section 46. Time-Sensitive Network (TSN) Configuration" of IEEE 802.1Qcc-2018. In the implementation of the present application, the message transmission direction is: sending a message from the second network device to the first network device. The second network device includes a second output port. The first network device includes a first input port and a first output port. Among them, the second output port of the second network device is connected to the first output port of the first network device via a communication link. The second network device can send a first message to the first network device via the second output port. After the first message is transmitted via the communication link, it arrives at the first input port of the first network device. The first network device can receive the first message via the first input port. After receiving the first message, the first network device can process the first message. Then, the first network device can send the processed first message to the next hop network device of the first network device via the first output port. Optionally, the second network device may include a second input port. When the second network device includes the second input port, the second network device may receive a second message sent by a previous network device of the second network device via the second input port. Then, the second network device processes the second message to obtain the corresponding first message. The first network device and the second network device may specifically be routers or switches. The embodiment of the present application is described by taking a communication link as an example, and it should be understood that multiple communication links may be included between the first network device and the second network device. That is, the first network device may include multiple first input interfaces, and the second network device may include multiple second output interfaces.

[0054] Figure 2 is based on Figure 1 Based on the network structure shown in FIG. 1 , the process of transmitting a message from the second network device to the first network device is shown. Figure 2 As shown, from top to bottom, a total of 4 horizontal long solid lines are shown, namely L1, L2, L3 and L4. Among them, L1 shows the message dequeue process of the second output port of the second network device; L2 shows the message dequeue process of the first input port of the first network device; L3 shows the message processing process inside the first network device; L4 shows the message dequeue process of the first output port of the first network device.

[0055] The second network device may set a plurality of buffers for the second egress port, and each of the plurality of buffers is used to buffer outgoing queue messages of the second egress port. Therefore, each of the plurality of buffers may be referred to as an egress port buffer. The plurality of buffers are cyclically scheduled by the second network device. For example, Figure 2 As shown in L1 in FIG. 1 , the second network device sets three caches for the second egress port, namely, cache a2, cache b2, and cache c2. Each cache is scheduled by the second network device at the same period, which is T c Therefore, T c It can be called the switching period of cache a2, cache b2 and cache c2. Specifically, in the period from T1=0 to T1=1, the second network device schedules cache a2, sends the message in cache a2 from the second egress port, and sends all the messages in cache a2 before T1=1 (that is, the message queue in cache a2 is emptied). The time length from T1=0 to T1=1 is T c . When T1=1, the second network device switches the scheduled cache from cache a2 to cache b2. Thus, in the period from T1=1 to T1=2, the second network device schedules cache b2, sends the messages in cache b2 from the second egress port, and sends all the messages in cache b2 before T1=2 (that is, the message queue in cache b2 is emptied). The time length from T1=1 to T1=2 is T c At T1=2, the second network device switches the scheduled cache from cache b2 to cache c2. Thus, in the period from T1=2 to T1=3, the second network device schedules cache c2, sends the messages in cache c2 from the second egress port, and sends all the messages in cache c2 before T1=3 (that is, the message queue in cache c2 is emptied). The time length from T1=2 to T1=3 is T c. According to the above, the cache set by the second network device is cyclically scheduled. Therefore, at T1=3, the second network device switches the scheduled cache from cache c2 to cache a2. Thus, in the period from T1=3 to T1=4, the second network device schedules cache a2, sends the messages in cache a2 from the second egress port, and sends all the messages in cache a2 before T1=4 (that is, the message queue in cache a2 is emptied). The time length from T1=3 to T1=4 is T c . By analogy, the cyclic scheduling of cache a2, cache b2 and cache c2 can be realized in this way. It should be understood that when the cache is not scheduled by the second network device in the period, it does not mean that the cache is not used by the second network device. For example, in the period from T1=1 to T1=3, cache a2 is not scheduled by the second network device, but during this period, cache a2 can cache messages so that the messages in cache a2 can be discharged when it is scheduled by the second network device next time. For details, please refer to the description of the subsequent implementation methods. The unit of T1 in the implementation method of this application may include milliseconds, microseconds or nanoseconds, which is not limited in this application. Moreover, the specific value of T1 in the above description is an exemplary value. According to the above description, whenever the T1 moment is reached, the cache scheduled by the second network device is switched, so T1 can be understood as the switching time of cache a2, cache b2 and cache c2. That is to say, T1 as a switching time can be regarded as the starting time when the cache (a2, b2 or c2) is scheduled, and can also be regarded as the end time when the cache (a2, b2 or c2) is scheduled.

[0056] The second network device sends a message to the first network device via the second outbound port. For example, the second network device schedules the T c During (T1=0 to T1=1), the second output port sends the first data message to the first network device. Figure 2As shown, the area formed by the two inclined connecting lines between L1 and L2 shows the interval in which the first data message can be sent. That is, in this area, the first data message is sent by the second network device via the second egress port and received by the first ingress port of the first network device. For example, the second network device starts to send the first data message via the second egress port at T1=0. Correspondingly, at T2=1.3, the first ingress port of the first network device can receive the first bit data of the first data message. In actual application scenarios, in order to prevent interference and jitter between different cache scheduled cycles, and to ensure that data messages are sent and received within the cycle, each cache scheduled cycle may also include a first idle cycle and a second idle cycle. The start time of the first idle cycle is the start time of each cache scheduled cycle, and the end time of the second idle cycle is the end time of each cache scheduled cycle. In the first idle cycle and the second idle cycle, the second network device does not send the message in the cache. The reason for the formation of the above two inclined connecting lines is that there is a link delay in the communication link between the second network device and the first network device, such as Figure 2 The minimum link delay is shown as 1.3T. c ". The link delay of the communication link can be obtained by multiple methods. For example, the second network device and the first network device measure the link delay of the communication link based on PTP. The minimum link delay can be understood as taking the minimum value after measuring the link delay for multiple times. The implementation mode of the present application is not limited to using the minimum link delay as the link delay. For example, the average link delay can also be used as the link delay, or the link delay obtained by a certain measurement can also be used as the link delay. The value of the minimum link delay (1.3T c ) is an example for the convenience of explanation.

[0057] Figure 2 L2 shows the message queue status of the first ingress port of the first network device. For example, the second network device sends the first data message via the second egress port. The first network device receives the first data message via the first ingress port. The first data message enters the message queue of the first network device so that the first network device processes the first data message. Figure 2 In L2, T2 = 0.3, T2 = 1.3, T2 = 2.3 and T2 = 3.3 are determined based on T1 and the minimum link delay. For example, first, by the formula: T 2偏移量 = minimum link delay mod T c =1.3T c mod Tc =0.3. The first network device knows the switching time corresponding to the first output port, that is, each specific time of T4. And because the second network device and the first network device are time synchronized, it is equivalent to that the first network device can determine the switching time corresponding to the second output port of the second network device, that is, each specific time of T1. The first network device determines the switching time corresponding to the second output port of the second network device according to T1 and T 2偏移量 Determine each moment of T2, for example: T2 = T1 + T 2偏移量 . Wherein, mod represents the modulo operation. Combined with the above description, T2 is determined based on T1 and the minimum link delay. The implementation method of this application introduces T2 to facilitate the description of the forwarding process of the data message between the second network device and the first network device. In an actual scenario, the first network device does not care whether T2 exists, that is, the first network device does not need to control or use T2.

[0058] Figure 2 L3 shows the message processing process inside the first network device. For example, after the first network device receives the first data message via the first input port, the first network device processes the first data message. The implementation mode of the present application does not limit the specific processing operations, which may include any form of operations. For example, the first network device updates the message header of the first data message; or the first network device updates the data payload of the first data message; or the first network device uses the first data message as a condition to generate a new data message; or the first network device keeps the first data message unchanged and only transparently transmits the first data message. After being processed by the first network device, a second data message is obtained. It should be understood that the second data message may be the same as the first data message, or it may be different. In Figure 2 In L3, T3 = 0.5, T3 = 1.5, T3 = 2.5 and T3 = 3.5 are based on T2 and the maximum processing delay F MAX For example, by the formula T3 = T2 + F MAX . Among them, the maximum processing delay can be understood as taking the maximum value after measuring the processing delay for multiple times. The implementation mode of the present application is not limited to using the maximum processing delay as the processing delay. For example, the average processing delay can also be used as the processing delay, or the link delay obtained from a certain measurement can be used as the link delay. T3 is introduced in the implementation mode of the present application to facilitate the explanation of the processing process of the data packet in the first network device. In an actual scenario, the first network device does not care whether T3 exists, that is, the first network device does not need to control or use T3.

[0059] like Figure 2 As shown, the area formed by the two inclined connecting lines between L2 and L3 shows the period in which the first data message can be processed. That is, the data message received by the first ingress port in the interval of T2=1.3 to T2=2.3, correspondingly, the first network device completes the corresponding processing in the interval of T3=1.5 to T3=2.5, and stores it in the cache of the first network device (for example, cache a1). For example, the first ingress port receives the first data message at T2=1.3. After receiving the first data message, the first network device processes the first data message. According to F MAX , the first network device completes processing of the first data message at T3=1.5 to obtain a second data message. Then, the first network device stores the second data message in a cache (eg, cache a1) of the first network device.

[0060] Figure 2 L4 shows the message dequeue process of the first egress port of the first network device. The first network device can set multiple caches for the first egress port, and each cache in the multiple caches is used to cache the out-queue message of the first egress port. Therefore, each cache in the multiple caches can be called an egress port cache. The multiple caches are cyclically scheduled by the first network device. Figure 2 As shown in L4 of FIG. 1 , the first network device sets three caches for the first egress port, namely, cache a1, cache b1, and cache c1. Each cache is scheduled by the first network device at the same period, which is T c Therefore, T c It can be called the switching period of cache a1, cache b1 and cache c1. Specifically, in the period from T4=0 to T4=1, the first network device schedules cache a1, sends the message in cache a1 from the first egress port, and sends all the messages in cache a1 before T4=1 (that is, the message queue in cache a1 is emptied). The time length from T4=0 to T4=1 is T c At T4=1, the first network device switches the scheduled cache from cache a1 to cache b1. Thus, during the period from T4=1 to T4=2, the first network device schedules cache b1, sends the messages in cache b1 from the first egress port, and sends all the messages in cache b1 before T4=2 (i.e., the message queue in cache b1 is emptied). The time length from T4=1 to T4=2 is T cAt T4=2, the first network device switches the scheduled cache from cache b1 to cache c1. Thus, during the period from T4=2 to T4=3, the first network device schedules cache c1, sends the messages in cache c1 from the first egress port, and sends all the messages in cache c1 before T4=3 (that is, the message queue in cache c1 is emptied). The time length from T4=2 to T4=3 is T c . According to the above, the cache set by the first network device is cyclically scheduled. Therefore, at T4=3, the first network device switches the scheduled cache from cache c1 to cache a1. Therefore, in the period from T4=3 to T4=4, the first network device schedules cache a1, sends the messages in cache a1 from the first output port, and sends all the messages in cache a1 before T4=4 (that is, the message queue in cache a1 is emptied). The time length from T4=3 to T4=4 is T c . And so on, in this way, the cyclic scheduling of cache a1, cache b1 and cache c1 can be implemented. The unit of T4 in the implementation manner of the present application may include milliseconds or microseconds or nanoseconds, and the present application does not limit it. Moreover, the specific value of T4 in the above description is an exemplary value. According to the above description, whenever the specific moment of T4 is reached, the cache scheduled by the second network device is switched. Therefore, T4 can be understood as the switching time of cache a1, cache b1 and cache c1. In other words, T4, as a switching time, can be regarded as the starting time when the cache (a2, b2 or c2) is scheduled, and it can also be regarded as the end time when the cache (a2, b2 or c2) is scheduled. Combined with the aforementioned Figure 2 According to the description of L1 in the second output port of the second network device, the switching period of the multiple caches of the second output port of the second network device is the same as the switching period of the multiple caches of the first output port of the first network device, both of which are T c Furthermore, the switching time of the multiple buffers of the second egress port of the second network device is synchronized with the switching time of the multiple buffers of the first egress port of the first network device, that is, T1 and T4 are synchronized.

[0061] In combination with the above, after the first network device completes processing of the first data message and obtains the second data message, the first network device saves the second data message into the cache of the first network device. Figure 2, in the period from T4=0 to T4=1, the first network device schedules cache a1. In this way, at T4=1, the packets stored in cache a1 have been all sent out by the first output port, that is, the packet queue in cache a1 is emptied. In the two periods from T4=1 to T4=2 and from T4=2 to T4=3, cache b1 and cache c1 are respectively scheduled by the first network device, while cache a1 is not scheduled by the first network device. Therefore, between T4=1 and T4=3, cache a1 can be used to store the packets processed by the network device, so that when the first network device schedules cache a1 again, the packets in cache a1 are sent. In actual application scenarios, although T1 and T4 are synchronized, and the first network device and the second network device have the same T c , but the first network device and the second network device will have a phase difference, such as Figure 2 T in L4 AB Therefore, at T AB During the period of T, cache a1 will not cache messages, and the storage space of cache a1 remains empty. AB After the cycle ends (T AB The end time is T AB The long dashed line on the right side of the interval), cache a1 can start caching messages. For further information, see Figure 2 According to L3, the first data message must be processed by the first network device between T3=1.5 and T3=2.5, and the second data message is generated. Obviously, the period from T3=1.5 to T3=2.5 falls into the period from T4=1 to T4=3, so the second data message will be received and stored by the cache a1. Moreover, the latest time when the second data message is stored by the cache a1 is T3=2.5. Combined with the above description, the data message sent by the second network device in the period from T1=0 to T1=1 can enter the cache a1 in the period from T3=1.5 to T3=2.5 (or before T3=2.5). In the period from T4=2 to T4=3, the cache c1 is being scheduled by the first network device. Therefore, before T4=3, even if the cache a1 has cached all the data messages sent by the second network device in the period from T1=0 to T1=1, these data messages will not be sent by the first output port. Therefore, in the period from T4=2 to T4=3, the data packets (second data packets) in the cache a1 all arrive at the outgoing queue of the first outgoing port, waiting to be sent. Then, at time T4=3, the cache of the first network device is switched, and in the period from T4=3 to T4=4, the cache a1 is re-scheduled by the first network device, and the data packets (second data packets) in the cache a1 are sent out by the first outgoing port.

[0062] Combination Figure 2 In the implementation shown, the first network device and the second network device need to perform precise time synchronization. For example, the scheduled period corresponding to the cache a2 of the second network device is T1=0 to T1=1, the scheduled period corresponding to the cache b2 is T1=1 to T1=2, and the scheduled period corresponding to the cache c2 is T1=2 to T1=3. Correspondingly, the scheduled period corresponding to the cache a1 of the first network device is T4=0 to T4=1, the scheduled period corresponding to the cache b1 is T4=1 to T4=2, and the scheduled period corresponding to the cache c1 is T4=2 to T4=3. Therefore, precise time synchronization increases the difficulty and cost of network deployment. In addition, there is clock jitter on the transmission path of the communication network. There may be multiple network devices on the transmission path, for example, there are network device 1, network device 2, network device 3, network device 4 and network device 5 on the transmission path. According to Figure 2 In the method described, network device 1, network device 2, network device 3, network device 4 and network device 5 need to perform accurate time synchronization. Clock jitter will be generated on each network device on the transmission path, and will continue to accumulate as the data message is transmitted along the transmission path. For example, when the data message arrives at network device 5, the clock jitter from network device 1 to network device 4 has been accumulated. Therefore, when performing accurate time synchronization in a communication network, the accumulation of clock jitter must also be considered, which inevitably increases the difficulty of achieving accurate time synchronization.

[0063] Figure 3 is based on Figure 1 Based on the network structure shown in FIG. 1 , the process of transmitting a message from the second network device to the first network device is shown. Figure 3 It can be seen from the implementation process shown that the switching time of each corresponding cache of L1 and L4 is different, so the time of the first network device and the second network device is not synchronized, that is, the first network device and the second network device can realize the queuing and forwarding of data packets without relying on time synchronization. Figure 2 Similarly, in Figure 3 In the figure, from top to bottom, a total of 4 horizontal long solid lines are shown, namely L1, L2, L3 and L4. Among them, L1 shows the message dequeue process of the second output port of the second network device; L2 shows the message dequeue process of the first input port of the first network device; L3 shows the message processing process inside the first network device; L4 shows the message dequeue process of the first output port of the first network device.

[0064] like Figure 3As shown, the second network device sets three caches for the second egress port, namely, cache a2, cache b2 and cache c2. Each cache is scheduled by the second network device at the same period, which is T c Correspondingly, the first network device sets three caches for the first egress port, namely, cache a1, cache b1, and cache c1. Each cache is scheduled by the first network device at the same period, which is T c .exist Figure 3 In the example, cache a2, cache b2, cache c2, cache a1, cache b1 and cache c1 are scheduled as described above. Figure 2 The description of is not repeated here. Figure 2 and Figure 3 The difference is that the time of the first network device and the second network device is not synchronized. Figure 3 In L4, during the period from T4=0.1 to T4=1.1, the first network device schedules cache a1; during the period from T4=1.1 to T4=2.1, the first network device schedules cache b1; during the period from T4=2.1 to T4=3.1, the first network device schedules cache c1; during the period from T4=3.1 to T4=4.1, the first network device reschedules cache a1. Figure 3 and Figure 4 The specific implementation manner in which the first network device and the second network device can realize queuing and forwarding of data packets without relying on time synchronization is specifically described.

[0065] Figure 4 A flow chart of a message forwarding method according to an embodiment of the present application. Figure 4 The method shown can be applied in Figure 1 In the network structure shown, Figure 3 Specifically, the method includes:

[0066] S101. A second network device generates a first message.

[0067] S102: The second network device sends the first message to the first network device via the second output port of the second network device.

[0068] S103. The first network device receives a first message sent by the second network device via the second egress port of the second network device, where the first message is used to measure a phase difference, where the phase difference is a phase difference between a switching time of a first cache among multiple first caches of the first egress port of the first network device and a switching time of a second cache among multiple second caches of the second egress port of the second network device, taking into account a link delay, wherein the link delay is a link delay from the second network device to the first network device.

[0069] exist Figure 3 In the implementation shown, in order to ensure that the use of resources of each cache does not exceed the limit, the communication network needs to plan the data traffic of the communication link flowing through the communication network. For example, the second network device sends out a first data message through the second outbound interface during the period of scheduling cache a2. The first network device obtains the corresponding second data message according to the first data message. Then, the first network device needs to determine which cache (cache a1, b1 or c1) to send the second data message during scheduling. When the number of the first data message is multiple, the number of the corresponding second data message is also multiple. When a certain cache (for example, cache a1) of the first network device is used to cache the second data message, cache a1 needs to cache all the second data messages and start sending the cached second data message when the scheduling period of cache a1 arrives. For example, the second network device sends out 10 first data messages through the second outbound interface during the period of scheduling cache a2 (10 first data messages are all data messages sent during the scheduling period of cache a2). The first network device obtains 10 corresponding second data messages according to the 10 first data messages. Then, the first network device caches the 10 second data packets into a certain cache (for example, cache a1). When the first network device determines that the 10 second data packets are all cached by cache a1, it starts to send the cached 10 second data packets when the scheduling period of cache a1 arrives. In order to implement the above method, the first network device needs to determine the first data packet received from the second network device scheduling cache a2 according to the phase difference TAB, and the first network device needs to determine the first data packet received from the second network device scheduling cache a2 according to the phase difference TAB. AB Determine a corresponding buffer for caching and sending the second data message. Figure 3 The implementation method of the present application proposes a method for determining the phase difference T AB The implementation method ensures that the first network device and the second network device can realize the queuing and forwarding of data messages without relying on time synchronization. In other words, whether the first network device and the second network device are configured for time synchronization or not does not affect the queuing and forwarding of data messages.

[0070] exist Figure 3 In the implementation shown, two types of messages may be defined, namely, a first message and a second message. The first message and the second message are both used to determine the phase difference T AB . Phase difference T AB is the phase difference between the switching time of one of the multiple first caches of the first egress port of the first network device and the switching time of one of the multiple second caches of the second egress port of the second network device, taking into account the link delay, wherein the link delay is the link delay from the second network device to the first network device. The multiple first caches may be Figure 3 The cache a1, cache b1 and cache c1 in the embodiment of the present invention may be Figure 3 The switching time of the multiple first caches of the first outbound port of the first network device can be Figure 3 T4 in; the switching time of the plurality of second caches of the second outbound port of the second network device may be Figure 3 Correspondingly, the phase difference T AB It can be considered as the phase difference between T4 and T1 when considering the link delay. Figure 3 , the switching time T4 includes T4=0.1, T4=1.1, T4=2.1, T4=3.1 and T4=4.1; the switching time T1 includes T1=0, T1=1, T1=2, T1=3 and T1=4. According to the above, since the switching period of T4 and the switching period of T1 are both T c Therefore, no matter which of the above five values ​​T4 is taken as, and no matter which of the above five values ​​T1 is taken as, the final calculated phase difference T AB For example, the phase difference between T4=1.1 and T1=1 is the same as the phase difference between T4=3.1 and T1=1. AB It refers to the phase difference when the link delay is taken into account. Specifically, when calculating the phase difference T AB The link delay is taken into account during the process. The link delay is the link delay from the second network device to the first network device, that is, the delay generated when the message passes through the link between the second network device and the first network device during the process of the second network device sending the message to the first network device.

[0071] Specifically, the first message is, for example, a cycle offset measurement message (COMM), and the second message is, for example, a cycle offset follow-up message (COFM). In one possible implementation, the second network device sends the first message and the second message to the first network device. In another possible implementation, the second network device sends the first message to the first network device, but does not send the second message. The following describes two implementations respectively, and in the subsequent description, COMM and COFM are used as examples for description.

[0072] In a possible implementation, the second network device sends COMM and COFM to the first network device. Specifically, the second network device generates COMM, which is used to measure the phase difference T AB Optionally, the COMM includes a first identifier, and the first identifier is used to identify the COMM so as to distinguish it from other COMMs. After generating the COMM, the second network device sends the COMM to the first network device via the second output port of the second network device. Figure 3 As shown in the "first message" in, the second network device schedules cache a2 in the period from T1=0 to T1=1. Correspondingly, the second network device sends COMM in the period from T1=0 to T1=1. COMM can be sent to the first network device together with the first data packet during the period when the second network device schedules cache a2 to send the first data packet. Of course, COMM may not be sent with the first data packet, but may be sent separately, for example, the second network device sends COMM before transmitting the data packet to the first network device. After sending COMM, the second network device records the first time and the second time. Among them, the first time is the time when the second network device sends COMM, such as Figure 3 T Tm The second time is a first switching time of a second cache in the plurality of second caches scheduled when COMM is sent, and the first switching time is earlier than the first time. Figure 3 As shown in , the COMM sent by the second network device during the scheduling buffer a2, therefore, the second time is Figure 3 T Sa , that is, T1=0.

[0073] After sending COMM, the second network device generates COFM. Optionally, COFM includes a second identifier, and the second identifier is used to identify COFM, and the second identifier corresponds to the first identifier. The second identifier corresponds to the first identifier, which means that the second identifier is the same as the first identifier, or there is a corresponding relationship between the second identifier and the first identifier. Through the second identifier and the first identifier, the first network device can determine that COMM and COFM are a pair of associated messages. Of course, COMM and COFM may not include the first identifier and the second identifier. In this way, after receiving COFM, the first network device defaults to forming a pair of associated messages between the COMM most recently received before receiving COFM and the COFM. Further, the COFM includes the first time T Tm and the second time T Sa , or the COFM includes the first time T Tm and the second time T Sa The difference, T Tm -T Sa The corresponding value.

[0074] Correspondingly, the first network device receives the COMM and COFM sent by the second network device via the second output port of the second network device. Specifically, after receiving the COMM, the first network device determines a third time according to the COMM, and the third time is the time when the first network device receives the COMM, such as Figure 3 T Rm Among them, T Rm It can be the time when the first network device receives the first bit of COMM data, or T Rm It may be the time when the first network device receives the entire content of the COMM. After the first network device determines the third time, it determines a fourth time according to the third time, the fourth time being the second switching time of the first cache in the plurality of first caches scheduled corresponding to when the COMM is received, and the second switching time is later than the third time. Figure 3 As shown in , the first network device knows each switching time of its own T4, and the first network device can determine the buffer b1 of the first network device that is scheduled when receiving COMM. Therefore, the first network device determines T4=2.1 as the fourth time according to the third time, that is, Figure 3 T Sb Thus, the first network device obtains the third time T Rm and the fourth time T SbIn addition, after receiving the COFM, the first network device can obtain the T Tm and T Sa , or obtain T in COFM Tm -T Sa The corresponding value.

[0075] In another possible implementation, the second network device sends COMM to the first network device, but does not send COFM. In order to distinguish the above implementation, COMM in this implementation is represented by COMM_1. The mechanism for the second network device to generate and send COMM_1 can be found in the above implementation, and will not be described in detail here. The content carried by COMM_1 in this implementation is different from the content carried by COMM in the above implementation. Since COFM is not sent in this implementation, the information in COFM can be carried in COMM_1. That is, COMM_1 includes the first time T Tm and the second time T Sa , or COMM_1 includes T Tm -T Sa The corresponding value. Wherein, the first time T Tm and the second time T Sa The explanation of can refer to the above-mentioned embodiment. It should be noted that, in this embodiment, the first time T Tm It is not the actual sending time of COMM_1 recorded by the second network device, but an estimated value calculated by the second network device according to the hardware condition of the second network device for processing messages.

[0076] The first network device receives COMM_1. The implementation of the first network device receiving COMM_1 can refer to the implementation of the first network device receiving COMM, which is not repeated here. After the first network device receives COMM_1, it can determine the third time T according to COMM_1. Rm and the fourth time T Sb The first network device determines the third time T Rm and the fourth time T Sb The implementation method of COMM_1 can refer to the above implementation method. In addition, after receiving COMM_1, the first network device can obtain T in COMM_1. Tm and T Sa , or get T in COMM_1 Tm -T Sa The corresponding value.

[0077] In the implementation manner of the present application, the delay generated when the first message is transmitted on the link from the second network device to the first network device is the same as the delay generated when the first data packet is transmitted on the link.

[0078] S104. The first network device determines the phase difference according to the first message, the switching period of the multiple first caches is the same as the switching period of the multiple second caches, the multiple first caches are cyclically scheduled by the first network device, and the multiple second caches are cyclically scheduled by the second network device.

[0079] In combination with the above, if the first network device receives COMM_1 of the above embodiment, the first network device determines the phase difference T according to COMM_1. AB If the first network device receives COMM and COFM of the aforementioned embodiment, the first network device determines the phase difference T according to COMM_1. AB Further, in combination with the above, the switching period of the second network device scheduling caches a2, b2, and c2 is T c , the switching period of the first network device scheduling caches a1, b1, and c1 is also T c Therefore, the switching period of the cache of the first network device is the same as the switching period of the cache of the second network device. In other words, the switching frequency of the cache of the first network device is the same as the switching frequency of the cache of the second network device. In addition, caches a1, b1, and c1 are cyclically scheduled by the first network device, and caches a2, b2, and c2 are cyclically scheduled by the second network device.

[0080] For example, the first network device determines the phase difference T AB , the phase difference T AB The value of is equal to the difference between the switching period of the plurality of first caches and the first value, wherein the first value is equal to the value modulo the switching period of the plurality of first caches by the second value, wherein the second value is equal to the sum of the difference between the first time and the second time and the difference between the fourth time and the third time. Specifically, as shown in Formula 1.

[0081] T AB =T c -(((T Tm -T Sa )+(T Sb -T Rm )) mod T c ) Formula 1

[0082] Among them, the switching period of the multiple first caches is T c , the first value is ((TTm -T Sa )+(T Sb -T Rm ))mod T c , the second value is (T Tm -T Sa )+(T Sb -T Rm ), mod represents the modulo operation.

[0083] The first network device can use the phase difference T AB Scheduling the data traffic received from the second network device, thereby realizing queuing and forwarding of the data traffic without relying on the time synchronization between the first network device and the second network device. It should be noted that there may be multiple links between the second network device and the first network device. For example, the egress port 21 of the second network device communicates with the ingress port 11 of the first network device via link 1, the egress port 22 of the second network device communicates with the ingress port 12 of the first network device via link 2, and the egress port 23 of the second network device communicates with the ingress port 13 of the first network device via link 3. The second network device and the first network device can determine the phase difference for link 1, link 2 and link 3 respectively according to the above implementation. That is, the phase difference T is determined for link 1. AB1 , determine the phase difference T for link 2 AB2 , determine the phase difference T for link 3 AB3 .

[0084] S105. The first network device needs to send a second data packet via the first output port according to the phase difference scheduling, the second data packet is a data packet obtained by the first network device based on the first data packet, and the first data packet is a data packet received by the first network device from the second output port of the second network device.

[0085] In conjunction with the foregoing, see Figure 3 , the second network device is not synchronized with the first network device, that is, T4 and T1 are not synchronized. For example, the second network device sends a first data message within the period (T1=0 to T1=1) of the scheduling buffer a2. The number of the first data messages is multiple. Figure 3 As shown in FIG. 1 , the area formed by the two inclined connecting lines between L1 and L2 (the inclined line from T1=0 to T2=1.3 and the inclined line from T1=1 to T2=2.3) shows the interval in which the first data message can be sent. That is, within this area, the first data message is sent by the second network device via the second egress port and is received by the first ingress port of the first network device. Figure 3 According to L2, the first network device receives the first data message via the first ingress port during a period from T2=1.3 to T2=2.3. Thus, the first data message enters the message queue of the first network device so that the first network device processes the first data message.

[0086] Figure 3 The value of T2 in L2 is the same as Figure 2 For details, see Figure 3 , the time of the second network device is not synchronized with that of the first network device, that is, T1 is not synchronized with T4. Therefore, the first network device cannot determine the value of T1 at each time by using the value of T4 at each time. However, in combination with the above, the first network device can calculate the phase difference T AB ,and, Figure 3 In order to achieve the phase difference T AB The link delay from the second network device to the first network device has been taken into account in the calculation of L2. Therefore, T2 in L2 can be calculated based on T4 and the phase difference T AB Determine, that is, T2 = T4 + T AB Equivalently, T2 in L2 can also be determined based on T4 and ① and ②, that is, T2 = T4-(T Tm -T Sa )+(T Sb -T Rm ).further, Figure 3 The determination method of T3 of L3 in can refer to Figure 2 The method for determining T3 of L3 in the embodiment of the present application is not described in detail here. Similarly, T2 and T3 are introduced in the implementation mode of the present application to facilitate the description of the forwarding process of data packets between the second network device and the first network device. In an actual scenario, the first network device does not care whether T2 and T3 exist, that is, the first network device does not need to control or use T2 and T3.

[0087] After the first network device receives the first data packet via the first ingress port, the first network device processes the first data packet. Figure 3 L3 shows the cycle of processing the first data packet, where the maximum processing delay F MAX For an explanation, see Figure 2The explanation of the embodiment is not repeated here. The area formed by the two inclined connecting lines between L2 and L3 shows the period in which the first data message can be processed. That is, the data message received by the first ingress port in the interval of T2=1.3 to T2=2.3, correspondingly, the first network device completes the corresponding processing in the interval of T3=1.5 to T3=2.5, obtains the corresponding second data message, and saves the second data message in the cache of the first network device. Wherein, the number of the second data messages is multiple.

[0088] See also Figure 3 In L4, in combination with the above, the second network device sends the calculated phase difference T in the period from T1 = 0 to T1 = 1 AB The first message and the second message are related. According to formula 1, T Tm -T Sa The result is mapped to the position on L4 as shown in the figure ①, T Sb -T Rm The result is mapped to the position on L4 as shown in ② in the figure. Correspondingly, the calculated phase difference T AB The location mapped to L4 is shown in the figure as “T AB ", that is, the time length from T4 = 1.1 to T2 = 1.3. It should be understood that the T displayed on L4 AB The position is just for illustration, and T is calculated based on the first message and the second message. AB When T AB The location of formation does not indicate T AB Fixed in the range from T4=1.1 to T2=1.3.

[0089] According to the above, the first network device completes the corresponding processing of the first data message within the interval of T3=1.5 to T3=2.5, and obtains the corresponding second data message. It should be understood that the first network device does not wait until all the second data messages are obtained before caching all the second data messages into the cache of the first network device. Each time the first network device obtains a second data message, it will cache the second data message into the cache queue of the first network device, waiting for transmission. Therefore, the processing of the first data message and the caching of the second data message by the first network device are carried out in parallel. Thus, the caching cycle of the second data message by the first network device is also completed within the interval of T3=1.5 to T3=2.5. If the duration of the caching action is considered, the end time of the caching cycle of the second data message may be slightly greater than T3=2.5, but this error does not affect the implementation of the technical solution of the present application. Therefore, the delay caused by the caching action is ignored in the description of the implementation method of the present application.

[0090] See also Figure 3 L4, in the period from T4=0.1 to T4=1.1, the first network device schedules cache a1. If cache a1 stores data packets to be sent at this time, the first network device will send these data packets via the first output interface in the period from T4=0.1 to T4=1.1. And at T4=1.1, all data packets stored in cache a1 have been sent out by the first output port, that is, the message queue in cache a1 is emptied. In the two periods from T4=1.1 to T4=2.1 and from T4=2.1 to T4=3.1, cache b1 and cache c1 are respectively scheduled by the first network device, while cache a1 is not scheduled by the first network device in these two periods. Figure 3 In the embodiment shown, the first network device can AB and the internal maximum processing delay F of the first network device MAX Determine in which cache the second data packet should be cached. Specifically, the first network device determines T AB +F MAX The corresponding period, that is, T AB +F MAX The corresponding period is the period from T4=1.1 to T3=1.5. The first network device is able to know that the cache b1 is scheduled in the period from T4=1.1 to T4=2.1. Therefore, the first network device determines T AB +F MAX The corresponding period has exceeded the start time (T4=1.1) of the scheduled cache b1, so the first network device will not use cache b1 to cache the second data message. Furthermore, the first data message is sent by the second network device within the period (T1=0 to T1=1) of scheduling cache a2, and the length of this period is T c That is, the earliest limit time for the second network device to send the first data message is T1=0, and the latest limit time is T1=1. Correspondingly, the length of the cycle for the first network device to process the first data message is also T c (in the interval of T3=1.5 to T3=2.5), that is, the latest limit time for the first network device to complete processing the first data message is T3=2.5. The first network device can determine T AB +F MAX +T c The first network device can know to schedule the cache c1 in the period from T4=2.1 to T4=3.1. AB +F MAX +Tc The latest time of the corresponding cycle (T3=2.5) has exceeded the start time (T4=2.1) of the scheduled cache c1. If the first network device uses cache c1 to cache the second data message, it may result in that all the second data messages have not been cached yet, and cache c1 has been scheduled and sent by the first network device. Therefore, the first network device will not use cache c1 to cache the second data message. Accordingly, the first network device can determine to use cache a1 to cache the second data message. Therefore, we can get from Figure 3 It can be seen that the period from T3=1.5 to T3=2.5 is mapped to L4, and the first network device can ensure that all second data packets are cached in the queue using cache a1 during the period of scheduling cache c1. That is to say, during the period from T4=2.1 to T4=3.1. The data packets (second data packets) in cache a1 all arrive at the outbound queue of the first output port, waiting to be sent. Then, at time T4=3.1, the cache of the first network device is switched, and during the period from T4=3.1 to T4=4.1, cache a1 is re-scheduled by the first network device, and the data packets (second data packets) in cache a1 are sent out by the first output port. In the above implementation, the maximum processing delay F is used. MAX In practical applications, it is not limited to using F MAX , other forms of processing delay can be used, such as average processing delay.

[0091] Optionally, in the first network device, there are four caches that can be scheduled, namely, caches a1, b1, c1 and d1. According to the above embodiment, the first network device cyclically schedules caches a1, b1, c1 and d1. According to the above method, the first network device schedules caches a1, b1, c1 and d1 according to the phase difference T AB It is determined that the second data message will not be cached using cache b1 or c1. Accordingly, the first network device may determine to use cache a1 or d1 to cache the second data message. Then, the first network device may determine that cache d1 will be scheduled earlier than cache a1. Therefore, the first network device will preferentially cache the second data message to cache d1, and wait for cache d1 to be scheduled again before sending the second data message.

[0092] Optionally, in an embodiment of the present application, the first message and the second message may be carried in a protocol message transmitted between the first network device and the second network device (for example, an Internet Protocol (IP) message is transmitted between the first network device and the second network device, then the first message and the second message may be carried in the IP message). A new protocol message may also be created in the first network device and the second network device to carry the first message and the second message.

[0093] For example, the IEEE 1588 protocol is running in the first network device and the second network device. Then, the first message can be carried in the Sync and Delay_Req message defined by IEEE 1588. For example, a type-length-value (TLV) field is added to the Syncand Delay_Req message to carry the content of the first message. Among them, the definition and explanation of the Sync and Delay_Req message can refer to the corresponding description in IEEE 1588-2008, such as Table-26 in IEEE 1588-2008. The second message can be carried in the Follow_Up message defined by IEEE1588. For example, a TLV field is added to the Follow_Up message to carry the content of the second message. Among them, the definition and explanation of the Follow_Up message can refer to the corresponding description in IEEE 1588-2008, such as Table-27 in IEEE 1588-2008.

[0094] Through the above implementation, the first network device determines the phase difference according to the message received from the second network device, wherein the first network device considers the link delay between the second network device and the first network device when determining the phase difference. Further, the first network device can schedule the data message sent via the first output port of the first network device according to the phase difference. Thus, the first network device and the second network device realize the queuing and forwarding of data messages without relying on time synchronization.

[0095] Figure 5 Schematic diagram of the structure of the first network device 1000 according to an embodiment of the present application. Figure 5 The first network device 1000 shown in the figure can execute the corresponding steps executed by the first network device in the method of the above embodiment. The first network device is deployed in a communication network, and the communication network also includes a second network device. Figure 7As shown, the first network device 1000 includes a receiving unit 1002 , a processing unit 1004 and a sending unit 1006 .

[0096] The receiving unit 1002 is used to receive a first message sent by a second network device via a second egress port of the second network device, the first message being used to measure a phase difference, the phase difference being a phase difference between a switching time of a first cache among a plurality of first caches of the sending unit 1006 of the first network device and a switching time of a second cache among a plurality of second caches of the second egress port of the second network device, taking into account a link delay, wherein the link delay is a link delay from the second network device to the first network device;

[0097] The processing unit 1004 is used to determine the phase difference according to the first message, the switching period of the multiple first caches is the same as the switching period of the multiple second caches, the multiple first caches are cyclically scheduled by the processing unit 1004, and the multiple second caches are cyclically scheduled by the second network device;

[0098] The processing unit 1004 is also used to schedule a second data packet sent via the sending unit 1006 according to the phase difference, wherein the second data packet is a data packet obtained by the processing unit 1004 based on the first data packet, and the first data packet is a data packet received by the receiving unit 1002 from the second output port of the second network device.

[0099] Optionally, before the processing unit 1004 determines the phase difference according to the first message, the receiving unit 1002 is also used to receive a second message sent by the second network device, the second message including a first time and a second time, the first time is the time when the second network device sends the first message, and the second time is a first switching time of the second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; in the processing unit 1004 determining the phase difference according to the first message, the processing unit 1004 is specifically used to determine the phase difference based on the first message and the second message.

[0100] Optionally, before the processing unit 1004 determines the phase difference according to the first message, the receiving unit 1002 is also used to receive a second message sent by the second network device, the second message including a first time difference, the first time difference being the difference between a first time and a second time, the first time being the time when the second network device sends the first message, the second time being a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; in the processing unit 1004 determining the phase difference according to the first message, the processing unit 1004 is specifically used to determine the phase difference based on the first message and the second message.

[0101] Optionally, in the processing unit 1004 determining the phase difference according to the first message and the second message, the processing unit 1004 is specifically used to: determine a third time for receiving the first message; determine a fourth time according to the third time, the fourth time being the second switching time of the first cache among the multiple first caches scheduled corresponding to when the first message is received, and the second switching time is later than the third time; determine the phase difference, the value of the phase difference being equal to the difference between the switching period of the multiple first caches and a first value, wherein the first value is equal to the value of the second value modulo the switching period of the multiple first caches, wherein the second value is equal to the sum of the difference between the first time and the second time and the difference between the fourth time and the third time.

[0102] Optionally, the first message includes a first identifier for identifying the first message, and the second message includes a second identifier for identifying the second message, and the first identifier corresponds to the second identifier.

[0103] Optionally, the first message includes a first time and a second time, the first time is the time when the second network device sends the first message, the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time.

[0104] Optionally, the first message includes a first time difference, which is the difference between a first time and a second time, the first time is the time when the second network device sends the first message, and the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time.

[0105] Optionally, in the processing unit 1004 determining the phase difference according to the first message, the processing unit 1004 is specifically used to: determine a third time for receiving the first message; determine a fourth time according to the third time, the fourth time being the second switching time of the first cache among the multiple first caches scheduled corresponding to when the first message is received, the second switching time being later than the third time; determine the phase difference, the value of the phase difference being equal to the difference between the switching period of the multiple first caches and the first value, wherein the first value is equal to the value of the second value modulo the switching period of the multiple first caches, wherein the second value is equal to the sum of the difference between the first time and the second time and the difference between the fourth time and the third time.

[0106] Optionally, in the second data message sent by the processing unit 1004 via the sending unit 1006 according to the phase difference scheduling, the processing unit 1004 is specifically used to: determine a first cache corresponding to the second data message according to the phase difference and the processing delay, the multiple first caches include the corresponding first cache, and the processing delay is a delay generated in the process of the processing unit 1004 determining the second data message according to the first data message; and save the second data message in the corresponding first cache;

[0107] In the first cycle in which the corresponding first cache is scheduled by the processing unit 1004 after the second data message is saved, the sending unit 1006 sends the second data message.

[0108] Figure 5 The first network device shown can execute the corresponding steps executed by the first network device in the method of the above embodiment. The first network device determines the phase difference based on the message received from the second network device, wherein the first network device considers the link delay between the second network device and the first network device when determining the phase difference. Further, the first network device can schedule the data message sent via the first output port of the first network device according to the phase difference. Thus, the first network device and the second network device realize the queuing and forwarding of data messages without relying on time synchronization.

[0109] Figure 6 Schematic diagram of the hardware structure of the first network device 1100 according to an embodiment of the present application. Figure 6 The first network device 1100 shown can execute the corresponding steps executed by the first network device in the method of the above embodiment.

[0110] like Figure 6As shown, the first network device 1100 includes a processor 1101, a memory 1102, an interface 1103 and a bus 1104. The interface 1103 can be implemented in a wireless or wired manner, and can be a network card. The processor 1101, the memory 1102 and the interface 1103 are connected via a bus 1104.

[0111] The interface 1103 may specifically include a transmitter and a receiver, which are used to send and receive information between the first network device and the second network device in the above embodiment, and between the first network device and the next-hop device of the first network device. For example, the interface 1103 is used to support receiving a first message sent by the second network device, or a first message and a second message sent. For another example, the interface 1103 is used to support receiving a data message sent by the second network device. For another example, the interface 1103 is used to support the first network device to send a data message. As an example, the interface 1103 is used to support Figure 4 The processor 1101 is used to perform the processing performed by the first network device in the above embodiment. For example, the processor 1101 is used to determine the phase difference; and / or other processes of the technology described herein. As an example, the processor 1101 is used to support Figure 4 The process S104 in the process. The memory 1102 includes an operating system 11021 and an application 11022, which are used to store programs, codes or instructions. When the processor or hardware device executes these programs, codes or instructions, the processing process involving the first network device in the method embodiment can be completed. Optionally, the memory 1102 may include a read-only memory (English: Read-only Memory, abbreviated: ROM) and a random access memory (English: Random Access Memory, abbreviated: RAM). Among them, the ROM includes a basic input / output system (English: Basic Input / Output System, abbreviated: BIOS) or an embedded system; the RAM includes an application and an operating system. When it is necessary to run the first network device 1100, it is started by the BIOS solidified in the ROM or the bootloader boot system in the embedded system, and the first network device 1100 is guided to enter a normal operating state. After the first network device 1100 enters a normal operating state, the application and operating system in the RAM are run, thereby completing the processing process involving the first network device in the method embodiment.

[0112] Understandably, Figure 6 Only a simplified design of the first network device 1100 is shown. In practical applications, the first network device may include any number of interfaces, processors or memories.

[0113] Figure 7 A schematic diagram of the hardware structure of another first network device 1200 according to an embodiment of the present application. Figure 7 The first network device 1200 shown can execute the corresponding steps executed by the first network device in the method of the above embodiment.

[0114] like Figure 7 The first network device 1200 includes: a main control board 1210, an interface board 1230, a switching network board 1220 and an interface board 1240. The main control board 1210, the interface boards 1230 and 1240, and the switching network board 1220 are connected to the system backplane through a system bus to achieve intercommunication. Among them, the main control board 1210 is used to complete functions such as system management, equipment maintenance, and protocol processing. The switching network board 1220 is used to complete data exchange between various interface boards (interface boards are also called line cards or service boards). The interface boards 1230 and 1240 are used to provide various service interfaces (for example, POS interfaces, GE interfaces, ATM interfaces, etc.) and realize the forwarding of data packets.

[0115] The interface board 1230 may include a central processor 1231, a forwarding table entry memory 1234, a physical interface card 1233, and a network processor 1232. The central processor 1231 is used to control and manage the interface board and communicate with the central processor on the main control board. The forwarding table entry memory 1234 is used to store forwarding table entries. The physical interface card 1233 is used to complete the reception and transmission of traffic. The network processor 1232 is used to control the physical interface card 1233 to receive and send traffic according to the forwarding table entries.

[0116] Specifically, the physical interface card 1233 is used to receive the first message (or the first message and the second message) sent by the second network device and receive the data message sent by the second network device. The physical interface card 1233 is also used to forward the data message to the next-hop network device of the first network device.

[0117] After the physical interface card 1233 receives the first message (or the first message and the second message) and the data packet, it sends the first message (or the first message and the second message) and the data packet to the central processor 1211 via the central processor 1231, and the central processor 1211 processes the first message (or the first message and the second message) and the data packet.

[0118] The central processor 1211 is also used to determine the phase difference.

[0119] The central processor 1231 is further used to control the network processor 1232 to obtain the forwarding table entries in the forwarding table entry memory 1234 , and the central processor 1231 is further used to control the network processor 1232 to forward the data message to the next-hop network device on the transmission path via the physical interface card 1233 .

[0120] It should be understood that the operation on the interface board 1240 in the embodiment of the present invention is consistent with the operation of the interface board 1230, and for the sake of brevity, it will not be repeated. It should be understood that the first network device 1200 of this embodiment can correspond to the functions and / or various steps implemented in the above method embodiment, and it will not be repeated here.

[0121] In addition, it should be noted that there may be one or more main control boards, and when there are multiple boards, they may include a main main control board and a standby main control board. There may be one or more interface boards. The stronger the data processing capability of the first network device, the more interface boards are provided. There may also be one or more physical interface cards on the interface board. There may be no switching network board, or there may be one or more switching network boards. When there are multiple switching network boards, load sharing redundant backup can be achieved together. Under the centralized forwarding architecture, the first network device may not need a switching network board, and the interface board assumes the processing function of the service data of the entire system. Under the distributed forwarding architecture, the first network device may have at least one switching network board, and the data exchange between multiple interface boards is realized through the switching network board, providing large-capacity data exchange and processing capabilities. Therefore, the data access and processing capabilities of the first network device of the distributed architecture are greater than those of the device of the centralized architecture. Which architecture to adopt depends on the specific networking deployment scenario, and no limitation is made here.

[0122] In addition, an embodiment of the present application provides a computer storage medium for storing computer software instructions used for the above-mentioned first network device, which includes a program designed for executing the above-mentioned method embodiment.

[0123] Figure 8 This is a schematic diagram of the structure of the second network device 2000 according to an embodiment of the present application. Figure 8 The second network device 2000 shown in the figure can execute the corresponding steps executed by the second network device in the method of the above embodiment. The second network device is deployed in a communication network, and the communication network also includes the first network device. Figure 8 As shown, the second network device 2000 includes a processing unit 2004 and a sending unit 2006 .

[0124] The processing unit 2004 is used to generate a first message, where the first message is used to trigger the first network device to determine a phase difference, where the phase difference is a phase difference between a switching time of a first cache among a plurality of first caches of a first egress port of the first network device and a switching time of a second cache among a plurality of second caches of a sending unit 2006 of the second network device, taking into account a link delay, wherein the link delay is a link delay from the second network device to the first network device;

[0125] The sending unit 2006 is used to send the first message to the first network device. The switching period of the multiple first caches is the same as the switching period of the multiple second caches. The multiple first caches are cyclically scheduled by the first network device, and the multiple second caches are cyclically scheduled by the processing unit 2004.

[0126] Optionally, the processing unit 2004 is also used to generate a second message, the second message including a first time and a second time, the first time is the time when the sending unit 2006 sends the first message, and the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; the sending unit 2006 is also used to send the second message to the first network device.

[0127] Optionally, the processing unit 2004 is also used to generate a second message, the second message including a first time difference, the first time difference being the difference between a first time and a second time, the first time being the time when the sending unit 2006 sends the first message, the second time being a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, the first switching time being earlier than the first time; the sending unit 2006 is also used to send the second message to the first network device.

[0128] Optionally, the first message includes a first identifier for identifying the first message, and the second message includes a second identifier for identifying the second message, and the first identifier corresponds to the second identifier.

[0129] Figure 8The first network device shown can execute the corresponding steps executed by the second network device in the method of the above embodiment. The first network device determines the phase difference based on the message received from the second network device, wherein the first network device considers the link delay between the second network device and the first network device when determining the phase difference. Further, the first network device can schedule the data message sent via the first output port of the first network device according to the phase difference. Thus, the first network device and the second network device realize the queuing and forwarding of data messages without relying on time synchronization.

[0130] Fig. 9 Schematic diagram of the hardware structure of the second network device 2100 according to an embodiment of the present application. Fig. 9 The second network device 2100 shown can execute the corresponding steps executed by the second network device in the method of the above embodiment.

[0131] like Fig. 9 As shown, the second network device 2100 includes a processor 2101, a memory 2102, an interface 2103 and a bus 2104. The interface 2103 can be implemented in a wireless or wired manner, and can be a network card. The processor 2101, the memory 2102 and the interface 2103 are connected via a bus 2104.

[0132] The interface 2103 may specifically include a transmitter and a receiver, and is used to send and receive information or data between the second network device and the first network device in the above embodiment. For example, the interface 2103 is used to support sending a first message (or a first message and a second message) to the first network device; for another example, the interface 2103 is used to support sending a data packet to the first network device. As an example, the interface 2103 is used to support Figure 4 The processor 2101 is used to execute the processing performed by the second network device in the above embodiment. For example, the processor 2101 is used to generate a first message (or a first message and a second message); and / or other processes for the technology described herein. As an example, the processor 2101 is used to support Figure 4The process S101 in the embodiment. The memory 2102 includes an operating system 21021 and an application 21022, which are used to store programs, codes or instructions. When the processor or hardware device executes these programs, codes or instructions, the processing process involving the second network device in the method embodiment can be completed. Optionally, the memory 2102 may include a read-only memory (English: Read-only Memory, abbreviated: ROM) and a random access memory (English: Random Access Memory, abbreviated: RAM). Among them, the ROM includes a basic input / output system (English: Basic Input / Output System, abbreviated: BIOS) or an embedded system; the RAM includes an application and an operating system. When it is necessary to run the second network device 2100, it is started by the BIOS solidified in the ROM or the bootloader boot system in the embedded system, and the second network device 2100 is guided to enter a normal operating state. After the second network device 2100 enters a normal operating state, the application and operating system in the RAM are run, thereby completing the processing process involving the second network device in the method embodiment.

[0133] Understandably, Fig. 9 Only a simplified design of the second network device 2100 is shown. In practical applications, the second network device may include any number of interfaces, processors or memories.

[0134] Fig.10 A schematic diagram of the hardware structure of another second network device 2200 according to an embodiment of the present application. Fig.10 The second network device 2200 shown can execute the corresponding steps executed by the second network device in the method of the above embodiment.

[0135] like Fig.10 The second network device 2200 includes: a main control board 2210, an interface board 2230, a switching network board 2220 and an interface board 2240. The main control board 2210, the interface boards 2230 and 2240, and the switching network board 2220 are connected to the system backplane through a system bus to achieve intercommunication. Among them, the main control board 2210 is used to complete functions such as system management, equipment maintenance, and protocol processing. The switching network board 2220 is used to complete data exchange between various interface boards (interface boards are also called line cards or service boards). The interface boards 2230 and 2240 are used to provide various service interfaces (for example, POS interfaces, GE interfaces, ATM interfaces, etc.) and realize the forwarding of data packets.

[0136] The interface board 2230 may include a central processor 2231, a forwarding table entry memory 2234, a physical interface card 2233, and a network processor 2232. The central processor 2231 is used to control and manage the interface board and communicate with the central processor on the main control board. The forwarding table entry memory 2234 is used to store the forwarding table entries. The physical interface card 2233 is used to complete the reception and transmission of traffic. The network processor 2232 is used to control the physical interface card 2233 to receive and send traffic according to the forwarding table entries.

[0137] Specifically, the physical interface card 2233 is used to send a first message (or a first message and a second message) to the first network device. The physical interface card 2233 is also used to send a data message to the first network device. In addition, the physical interface card 2233 is also used to receive a data message sent by the previous hop network device of the second network device.

[0138] After receiving the data message sent by the previous-hop network device of the second network device, the physical interface card 2233 sends the data message to the central processor 2211 via the central processor 2231, and the central processor 2211 processes the data message.

[0139] The central processor 2211 is used to generate a first message (or a first message and a second message).

[0140] The central processor 2231 is further used to control the network processor 2232 to obtain the forwarding table entries in the forwarding table entry memory 2234 , and the central processor 2231 is further used to control the network processor 2232 to complete the reception and transmission of traffic via the physical interface card 2233 .

[0141] It should be understood that the operation on the interface board 2240 in the embodiment of the present invention is consistent with the operation of the interface board 2230, and for the sake of brevity, it will not be repeated. It should be understood that the second network device 2200 of this embodiment can correspond to the functions and / or various steps implemented in the above method embodiment, and it will not be repeated here.

[0142] In addition, it should be noted that there may be one or more main control boards, and when there are multiple boards, they may include a main main control board and a standby main control board. There may be one or more interface boards. The stronger the data processing capability of the second network device, the more interface boards are provided. There may also be one or more physical interface cards on the interface board. There may be no switching network board, or there may be one or more switching network boards. When there are multiple switching network boards, load sharing redundant backup can be achieved together. Under the centralized forwarding architecture, the second network device may not need a switching network board, and the interface board assumes the processing function of the service data of the entire system. Under the distributed forwarding architecture, the second network device may have at least one switching network board, and the data exchange between multiple interface boards is realized through the switching network board, providing large-capacity data exchange and processing capabilities. Therefore, the data access and processing capabilities of the second network device of the distributed architecture are greater than those of the device of the centralized architecture. Which architecture to adopt depends on the specific networking deployment scenario, and no limitation is made here.

[0143] In addition, an embodiment of the present application provides a computer storage medium for storing computer software instructions used for the above-mentioned second network device, which includes a program designed for executing the above-mentioned method embodiment.

[0144] The embodiment of the present application also includes a network system, wherein the network system includes a first network device and a second network device, wherein the first network device is the aforementioned Figure 5 or Figure 6 or Figure 7 The first network device in the embodiment, the second network device is the aforementioned Figure 8 or Fig. 9 or Fig.10 The second network device in.

[0145] The steps of the method or algorithm described in conjunction with the disclosure of the present application can be implemented in a hardware manner, or can be implemented by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a mobile hard disk, a CD-ROM or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a user device. Of course, the processor and the storage medium can also be present in the user device as discrete components.

[0146] Those skilled in the art should be aware that in one or more of the above examples, the functions described in this application can be implemented in hardware or in a combination of hardware and software. When implemented using a combination of hardware and software, the software can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media includes any medium that is convenient for transmitting a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.

[0147] The specific implementations described above further describe the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only a specific implementation of the present application.

Claims

1. A message forwarding method, characterized in that: The method comprises: A first network device receives a first message sent by a second network device via a second egress port of the second network device, wherein the first message is used to measure a phase difference, wherein the phase difference is a phase difference between a switching time of a first cache among a plurality of first caches of a first egress port of the first network device and a switching time of a second cache among a plurality of second caches of the second egress port of the second network device, taking into account a link delay, wherein the link delay is a link delay from the second network device to the first network device; the second egress port of the second network device is connected to the first egress port of the first network device via a communication link; The first network device determines the phase difference according to the first message, the switching period of the plurality of first caches is the same as the switching period of the plurality of second caches, the plurality of first caches are cyclically scheduled by the first network device, and the plurality of second caches are cyclically scheduled by the second network device; The first network device schedules a second data packet sent via the first output port according to the phase difference, the second data packet is a data packet obtained by the first network device based on the first data packet, and the first data packet is a data packet received by the first network device from the second output port of the second network device.

2. The method according to claim 1, characterized in that Before the first network device determines the phase difference according to the first message, the method further includes: The first network device receives a second message sent by the second network device, where the second message includes a first time and a second time, where the first time is the time when the second network device sends the first message, and the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; The first network device determines the phase difference according to the first message, specifically including: the first network device determines the phase difference according to the first message and the second message.

3. The method according to claim 1, characterized in that Before the first network device determines the phase difference according to the first message, the method further includes: The first network device receives a second message sent by the second network device, where the second message includes a first time difference, where the first time difference is a difference between a first time and a second time, where the first time is a time when the second network device sends the first message, and the second time is a first switching time of a second cache among the plurality of second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; The first network device determines the phase difference according to the first message, specifically including: the first network device determines the phase difference according to the first message and the second message.

4. The method according to claim 2 or 3, characterized in that The first network device determines the phase difference according to the first message and the second message, including: The first network device determines a third time for receiving the first message; The first network device determines a fourth time according to the third time, the fourth time being a second switching time of a first cache among the plurality of first caches scheduled corresponding to when the first message is received, and the second switching time is later than the third time; The first network device determines the phase difference, wherein the value of the phase difference is equal to the difference between the switching period of the multiple first caches and a first value, wherein the first value is equal to the value modulo the switching period of the multiple first caches by a second value, wherein the second value is equal to the sum of the difference between the first time and the second time and the difference between the fourth time and the third time.

5. The method according to claim 2 or 3, characterized in that: The first message includes a first identifier for identifying the first message, and the second message includes a second identifier for identifying the second message, and the first identifier corresponds to the second identifier.

6. The method according to claim 1, characterized in that The first message includes a first time and a second time, the first time is the time when the second network device sends the first message, the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time.

7. The method according to claim 1, characterized in that The first message includes a first time difference, which is the difference between a first time and a second time. The first time is the time when the second network device sends the first message, and the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time.

8. The method according to claim 6 or 7, characterized in that The first network device determines the phase difference according to the first message, including: The first network device determines a third time for receiving the first message; The first network device determines a fourth time according to the third time, the fourth time being a second switching time of a first cache among the plurality of first caches scheduled corresponding to when the first message is received, and the second switching time is later than the third time; The first network device determines the phase difference, wherein the value of the phase difference is equal to the difference between the switching period of the multiple first caches and a first value, wherein the first value is equal to the value modulo the switching period of the multiple first caches by a second value, wherein the second value is equal to the sum of the difference between the first time and the second time and the difference between the fourth time and the third time.

9. The method according to any one of claims 1 to 3, 6 to 7, characterized in that: The first network device schedules the second data packet sent via the first output port according to the phase difference, including: The first network device determines a first cache corresponding to the second data message according to the phase difference and the processing delay, the multiple first caches include the corresponding first cache, and the processing delay is a delay generated in the process of the first network device determining the second data message according to the first data message; The first network device stores the second data message in the corresponding first cache; In a first cycle in which the corresponding first buffer is scheduled by the first network device after the second data packet is stored, the first network device sends the second data packet via the first egress port.

10. A message forwarding method, characterized in that: The method comprises: The second network device generates a first message, the first message is used to trigger the first network device to determine a phase difference, the phase difference is a phase difference between a switching time of a first cache among a plurality of first caches of a first egress port of the first network device and a switching time of a second cache among a plurality of second caches of a second egress port of the second network device, taking into account a link delay, wherein the link delay is a link delay from the second network device to the first network device; the second egress port of the second network device is connected to the first egress port of the first network device via a communication link; The second network device sends the first message to the first network device via the second output port of the second network device, the switching period of the multiple first caches is the same as the switching period of the multiple second caches, the multiple first caches are cyclically scheduled by the first network device, and the multiple second caches are cyclically scheduled by the second network device.

11. The method according to claim 10, characterized in that The method further comprises: The second network device generates a second message, the second message includes a first time and a second time, the first time is the time when the second network device sends the first message, the second time is a first switching time of a second cache among the plurality of second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; The second network device sends the second message to the first network device via the second egress port of the second network device.

12. The method according to claim 10, characterized in that The method further comprises: The second network device generates a second message, the second message includes a first time difference, the first time difference is a difference between a first time and a second time, the first time is a time when the second network device sends the first message, the second time is a first switching time of a second cache among the plurality of second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; The second network device sends the second message to the first network device via the second egress port of the second network device.

13. The method according to claim 11 or 12, characterized in that The first message includes a first identifier for identifying the first message, and the second message includes a second identifier for identifying the second message, and the first identifier corresponds to the second identifier.

14. A first network device, characterized in that: The first network device comprises: a receiving unit, configured to receive a first message sent by a second network device via a second egress port of the second network device, the first message being used to measure a phase difference, the phase difference being a phase difference between a switching time of a first cache among a plurality of first caches of a sending unit of the first network device and a switching time of a second cache among a plurality of second caches of the second egress port of the second network device, taking into account a link delay, wherein the link delay is a link delay from the second network device to the first network device; the second egress port of the second network device is connected to the first egress port of the first network device via a communication link; a processing unit, configured to determine the phase difference according to the first message, wherein a switching period of the plurality of first caches is the same as a switching period of the plurality of second caches, the plurality of first caches are cyclically scheduled by the processing unit, and the plurality of second caches are cyclically scheduled by the second network device; The processing unit is also used to schedule a second data packet sent via the sending unit according to the phase difference, wherein the second data packet is a data packet obtained by the processing unit based on the first data packet, and the first data packet is a data packet received by the receiving unit from the second output port of the second network device.

15. The first network device according to claim 14, characterized in that: Before the processing unit determines the phase difference according to the first message, the receiving unit is further used to receive a second message sent by the second network device, the second message including a first time and a second time, the first time is the time when the second network device sends the first message, the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time; In the process where the processing unit determines the phase difference according to the first message, the processing unit is specifically configured to determine the phase difference according to the first message and the second message.

16. The first network device according to claim 14, characterized in that: Before the processing unit determines the phase difference according to the first message, the receiving unit is further used to receive a second message sent by the second network device, where the second message includes a first time difference, where the first time difference is a difference between a first time and a second time, where the first time is a time when the second network device sends the first message, where the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and where the first switching time is earlier than the first time; In the process where the processing unit determines the phase difference according to the first message, the processing unit is specifically configured to determine the phase difference according to the first message and the second message.

17. The first network device according to claim 15 or 16, characterized in that: In determining, by the processing unit, the phase difference according to the first message and the second message, the processing unit is specifically configured to: determining a third time for receiving the first message; Determine a fourth time according to the third time, where the fourth time is a second switching time of a first cache among the plurality of first caches scheduled corresponding to when the first message is received, and the second switching time is later than the third time; Determine the phase difference, the value of the phase difference is equal to the difference between the switching period of the multiple first caches and a first value, wherein the first value is equal to the value modulo the switching period of the multiple first caches by a second value, wherein the second value is equal to the sum of the difference between the first time and the second time and the difference between the fourth time and the third time.

18. The first network device according to claim 15 or 16, characterized in that: The first message includes a first identifier for identifying the first message, and the second message includes a second identifier for identifying the second message, and the first identifier corresponds to the second identifier.

19. The first network device according to claim 14, characterized in that: The first message includes a first time and a second time, the first time is the time when the second network device sends the first message, the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time.

20. The first network device according to claim 14, characterized in that: The first message includes a first time difference, which is the difference between a first time and a second time. The first time is the time when the second network device sends the first message, and the second time is a first switching time of a second cache among the multiple second caches scheduled when the first message is sent, and the first switching time is earlier than the first time.

21. The first network device according to claim 19 or 20, characterized in that: In determining, by the processing unit, the phase difference according to the first message, the processing unit is specifically configured to: determining a third time for receiving the first message; Determine a fourth time according to the third time, where the fourth time is a second switching time of a first cache among the plurality of first caches scheduled corresponding to when the first message is received, and the second switching time is later than the third time; Determine the phase difference, the value of the phase difference is equal to the difference between the switching period of the multiple first caches and a first value, wherein the first value is equal to the value modulo the switching period of the multiple first caches by a second value, wherein the second value is equal to the sum of the difference between the first time and the second time and the difference between the fourth time and the third time.

22. The first network device according to any one of claims 14-16, 19-20, characterized in that: In the second data message sent by the processing unit via the sending unit according to the phase difference scheduling, the processing unit is specifically configured to: Determine a first cache corresponding to the second data message according to the phase difference and the processing delay, the multiple first caches include the corresponding first cache, and the processing delay is a delay generated in a process in which the processing unit determines the second data message according to the first data message; and Storing the second data message in the corresponding first cache; The sending unit sends the second data message in a first cycle in which the corresponding first cache is scheduled by the processing unit after the second data message is saved.

23. A second network device, characterized in that: The second network device comprises: a processing unit, configured to generate a first message, wherein the first message is used to trigger the first network device to determine a phase difference, wherein the phase difference is a phase difference between a switching time of a first cache among a plurality of first caches of a first egress port of the first network device and a switching time of a second cache among a plurality of second caches of a sending unit of the second network device, taking into account a link delay, wherein the link delay is a link delay from the second network device to the first network device; the second egress port of the second network device is connected to the first egress port of the first network device via a communication link; The sending unit is used to send the first message to the first network device, the switching period of the multiple first caches is the same as the switching period of the multiple second caches, the multiple first caches are cyclically scheduled by the first network device, and the multiple second caches are cyclically scheduled by the processing unit.

24. The second network device according to claim 23, characterized in that: The processing unit is further configured to generate a second message, the second message including a first time and a second time, the first time being the time when the sending unit sends the first message, the second time being a first switching time of a second cache among the plurality of second caches scheduled when the first message is sent, the first switching time being earlier than the first time; The sending unit is further configured to send the second message to the first network device.

25. The second network device according to claim 24, characterized in that: The processing unit is further configured to generate a second message, the second message including a first time difference, the first time difference being a difference between a first time and a second time, the first time being a time when the sending unit sends the first message, the second time being a first switching time of a second cache among the plurality of second caches scheduled when the first message is sent, the first switching time being earlier than the first time; The sending unit is further configured to send the second message to the first network device.

26. The second network device according to claim 24 or 25, characterized in that: The first message includes a first identifier for identifying the first message, and the second message includes a second identifier for identifying the second message, and the first identifier corresponds to the second identifier.

27. A network system, characterized in that: The network system includes a first network device and a second network device, wherein the first network device is the first network device described in any one of claims 14-22, and the second network device is the second network device described in any one of claims 23-26.

28. A computer storage medium, characterized in that Used to store instructions used by the first network device, when a processor or a hardware device executes the instructions, the processor or the hardware device executes the method according to any one of claims 1-9.

29. A computer storage medium, characterized in that Used to store instructions used by the second network device, when a processor or a hardware device executes the instructions, the processor or the hardware device executes the method according to any one of claims 10-13.

Citation Information

Patent Citations

  • Method for achieving high-availability of itineraries in a real-time network scheduled packet routing system

    US8477616B1