A communication method and apparatus
By sending a notification message about the pause duration and updating the flow table entries when switching data flow paths, the problem of out-of-order data flow is solved, and ordered transmission is achieved during the path adjustment process.
Patent Information
- Application Number
- CN202510218663.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2026-08-25
AI Technical Summary
When the forwarding path of a data stream is adjusted, packets in the data stream may become out of order, affecting service quality.
The first network device sends a notification message to the second network device, which includes a pause duration, instructing the device to stop sending data streams within that duration. This ensures that the packets received by the destination device are not out of order and updates the flow table entries to match the new path after the path switch.
This effectively avoids out-of-order data flow during path adjustment, ensuring orderly data transmission and improving the service quality of network devices.
Smart Images

Figure CN122640344A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a communication method and apparatus. Background Technology
[0002] Adaptive flow repathing (AFR) is a data flow-level path optimization technique that adjusts the forwarding paths of data flows based on network congestion, thereby achieving network-wide load balancing. Specifically, AFR determines the forwarding paths of data flows based on network topology, path information, network congestion thresholds, and information about the data flows to be transmitted in the network, thus adjusting these paths to achieve network-wide load balancing.
[0003] Currently, when the forwarding path of a data stream is adjusted, it may cause the data stream to become out of order. A data stream consists of multiple packets, and out-of-order data flow refers to a situation where the order in which the sending end transmits these packets differs from the order in which the destination device receives them.
[0004] Therefore, a solution is urgently needed to address the above problems. Summary of the Invention
[0005] This application provides a communication method that ensures that the data stream is not out of order when the forwarding path of the data stream is adjusted.
[0006] Firstly, this application provides a communication method applied to a first network device, wherein the first network device determines that the path for forwarding a first data stream is switched from a first path to a second path. In this application, considering that the performance of the second path after the switch is generally better than that of the first path before the switch, if the first data stream is immediately sent through the second path, it may cause out-of-order packets in the first data stream. For example, packets sent through the second path in the first data stream may arrive at the destination device of the first data stream before packets sent through the first path. To avoid this problem, in response to determining that the path for forwarding the first data stream has been switched from the first path to the second path, the first network device sends a notification message to a second network device. The notification message includes a pause duration, which instructs the second network device to stop sending the first data stream to the first network device during the pause duration. The pause duration is used to ensure that packets in the first data stream received by the destination device of the first data stream are not out of order. In other words, after the first network device determines that the path for forwarding the first data stream has switched from the first path to the second path, the second network device stops sending the first data stream to the first network device during the pause period. Therefore, the first network device will not immediately send the first data stream through the second path, thus avoiding out-of-order packets in the first data stream. In short, this scheme can prevent out-of-order packets in the first data stream when the forwarding path of the first data stream is adjusted.
[0007] In one possible implementation, the pause duration can be determined based on the latency of the first path and the latency of the second path. The latency of the first path is greater than the latency of the second path, assuming the difference between the latency of the first path and the latency of the second path is a first difference value. Then, if the first network device forwards the first data stream through the first path and waits at least the first difference value before forwarding the first data stream through the second path, the first data stream will not be out of order. Therefore, the pause duration can be greater than the difference between the latency of the first path and the latency of the second path.
[0008] In one possible implementation, when the first network device determines that it will forward the first data stream via the first path, the first flow table includes the correspondence between the flow identifier of the first data stream and the identifier of the first path. After the first network device determines that it is switching its path for forwarding the first data stream from the first path to the second path, it can update the path identifier corresponding to the first data stream in the first flow table from the identifier of the first path to the identifier of the second path. That is, after the first network device determines that it is switching its path for forwarding the first data stream from the first path to the second path, it updates the information corresponding to the first data stream in the first flow table, and the updated first flow table includes the correspondence between the flow identifier of the first data stream and the identifier of the second path. In this way, the updated first flow table is consistent with the path currently determined by the first network device for forwarding the first data stream.
[0009] In one possible implementation, after the first network device sends a notification message to the second network device, the second network device suspends sending the first data stream to the first network device for a specified pause period. Therefore, the first network device will not use the entry in the second flow table corresponding to the flow identifier of the first data stream to determine the path for forwarding the first data stream for a certain period. Consequently, the aging flag of the entry in the second flow table corresponding to the flow identifier of the first data stream will not be cleared, resulting in the aging flag not being cleared within the timer interval. Accordingly, the first network device will delete the entry in the second flow table corresponding to the flow identifier of the first data stream. This avoids the first network device from continuing to forward the first data stream through the first path for an extended period after determining that its forwarding path has switched from the first path to the second path.
[0010] In one possible implementation, after deleting the entry in the second flow table corresponding to the flow identifier of the first data flow, the first network device can receive a first packet sent by the second network device, the first packet belonging to the first data flow. The first packet may be a packet sent by the second network device to the first network device after the aforementioned pause duration has elapsed. After receiving the first packet, the first network device can use the flow identifier of the first data flow to query the first flow table to obtain the identifier of the second path, and then forward the first packet through the second path. Thus, the first network device achieves the switching of the forwarding path of the first data flow from the first path to the second path.
[0011] In one possible implementation, when determining the path for forwarding a packet, the first network device first queries the second flow table indexed by the flow identifier of the data stream. If no corresponding entry is found in the second flow table, it further queries the first flow table to determine the path for forwarding the packet. Therefore, in one example, the first network device can query the second flow table using the flow identifier of the first data stream before querying the first flow table using the flow identifier of the first data stream. As described above, since the entry corresponding to the flow identifier of the first data stream in the second flow table has been deleted, the first network device can determine that the second flow table does not contain an entry corresponding to the flow identifier of the first data stream when querying the second flow table using the flow identifier of the first data stream. In this case, the first network device can further query the first flow table to determine the path for forwarding the first packet even if the second flow table does not contain an entry corresponding to the flow identifier of the first data stream.
[0012] In one possible implementation, after the first network device queries the first flow table to determine that the first packet will be forwarded via the second path, it can create an entry corresponding to the flow identifier of the first data flow in the second flow table. The created entry includes the identifier of the second path. After the first network device creates the entry corresponding to the flow identifier of the first data flow in the second flow table, the second flow table will include an entry corresponding to the flow identifier of the first data flow, and this entry will include the identifier of the second path. Thus, when the first network device subsequently needs to forward a third packet from the first data flow, it can query the second flow table using the flow identifier of the first data flow as an index to obtain the identifier of the second path, thereby forwarding the third packet via the second path.
[0013] In one possible implementation, before the entry corresponding to the flow identifier of the first data flow in the second flow table is deleted, for a second packet belonging to the first data flow that the first network device is to forward, the first network device can query the second flow table through the flow identifier of the first data flow to obtain the identifier of the first path, and further forward the second packet through the first path.
[0014] In one possible implementation, considering that an increase in the path load of the first path or congestion of the first path would lead to a decrease in the performance of forwarding the first data stream through the first path, the first network device may determine to switch its path for forwarding the first data stream from the first path to the second path when the path load of the first path increases or the first path becomes congested.
[0015] Secondly, this application provides a communication method applied to a second network device. The second network device receives a notification message sent by a first network device. The notification message includes a pause duration, which instructs the second network device to stop sending the first data stream to the first network device during the pause duration. The pause duration ensures that packets in the first data stream received by the destination device of the first data stream are not out of order. After receiving the notification message, the second network device stops sending the first data stream to the first network device during the pause duration. In one example, the notification message is sent by the first network device to the second network device when it determines that it needs to adjust its forwarding path for the first data stream. In this way, after the first network device determines that it needs to adjust its forwarding path for the first data stream, the second network device stops sending the first data stream to the first network device during the pause duration. Therefore, the first network device will not immediately send the first data stream through the adjusted path, thus avoiding out-of-order packets in the first data stream. That is, using this solution, out-of-order packets in the first data stream can be avoided when the forwarding path of the first data stream is adjusted.
[0016] In one possible implementation, the pause duration is greater than the difference between the delay of the first path and the delay of the second path.
[0017] In one possible implementation, the method further includes: after the duration of pausing the transmission of the first data stream to the first network device reaches the pause duration, sending a first message to the first network device, wherein the first message belongs to the first data stream.
[0018] Thirdly, this application provides a communication device applied to a first network device, the device comprising: a processing unit configured to determine that the path for forwarding a first data stream by the first network device is switched from a first path to a second path; and a sending unit configured to, in response to determining that the path for forwarding the first data stream by the first network device is switched from the first path to the second path, send a notification message to a second network device, the notification message including a pause duration, the pause duration instructing the second network device to stop sending the first data stream to the first network device during the pause duration, the pause duration being used to ensure that packets in the first data stream received by the destination device of the first data stream are not out of order.
[0019] In one possible implementation, the pause duration is greater than the difference between the delay of the first path and the delay of the second path.
[0020] In one possible implementation, the processing unit is further configured to: in response to determining that the path for forwarding the first data stream by the first network device has been switched from the first path to the second path, update the path identifier corresponding to the first data stream in the first flow table from the identifier of the first path to the identifier of the second path.
[0021] In one possible implementation, the processing unit is further configured to: delete the entry in the second flow table corresponding to the flow identifier of the first data flow.
[0022] In one possible implementation, the apparatus further includes: a receiving unit, configured to receive a first packet sent by the second network device after deleting the entry in the second flow table corresponding to the flow identifier of the first data flow, wherein the first packet belongs to the first data flow; the processing unit is further configured to: query the first flow table using the flow identifier of the first data flow to obtain the identifier of the second path; and the sending unit is further configured to forward the first packet through the second path.
[0023] In one possible implementation, the processing unit is further configured to query the second flow table using the flow identifier of the first data stream before querying the first flow table using the flow identifier of the first data stream, and determine that the second flow table does not include the entry corresponding to the flow identifier; the processing unit's use of the flow identifier to query the first flow table specifically includes: the processing unit is configured to query the first flow table using the flow identifier of the first data stream in response to determining that the second flow table does not include the entry corresponding to the flow identifier.
[0024] In one possible implementation, the processing unit is further configured to: create an entry in the second flow table corresponding to the flow identifier of the first data flow, wherein the created entry includes: the identifier of the second path.
[0025] In one possible implementation, the processing unit is further configured to query the second flow table using the flow identifier of the first data stream before deleting the table entry stored in the second flow table corresponding to the flow identifier of the first data stream, to obtain the identifier of the first path; the sending unit is further configured to forward a second packet through the first path, the second packet belonging to the first data stream.
[0026] In one possible implementation, the processing unit is configured to determine that the path for the first network device to forward the first data stream is switched from the first path to the second path. Specifically, the processing unit is configured to determine that when the path load of the first path increases or the first path becomes congested, the path for the first network device to forward the first data stream is switched from the first path to the second path.
[0027] Fourthly, this application provides a communication device applied to a second network device. The device includes: a receiving unit for receiving a notification message sent by a first network device, the notification message including a pause duration, the pause duration instructing the second network device to stop sending the first data stream to the first network device within the pause duration, the pause duration being used to ensure that the packets in the first data stream received by the destination device of the first data stream are not out of order; and a processing unit for stopping sending the first data stream to the first network device within the pause duration.
[0028] In one possible implementation, the pause duration is greater than the difference between the delay of the first path and the delay of the second path.
[0029] In one possible implementation, the apparatus further includes: a sending unit, configured to send a first message to the first network device after the duration of the pause in sending the first data stream to the first network device reaches the pause duration, wherein the first message belongs to the first data stream.
[0030] Fifthly, this application provides an apparatus. The apparatus includes a processor and a memory. The memory is used to store instructions or computer programs. The processor is used to execute the instructions or computer programs in the memory to perform the methods described in the first aspect and any one thereof. Alternatively, the processor is used to execute the instructions or computer programs in the memory to perform the methods described in the second aspect and any one thereof.
[0031] Sixthly, this application provides a computer-readable storage medium including instructions or a computer program that, when run on a computer, causes the computer to perform the methods described in the first aspect and any one of the first aspects above, or causes the computer to perform the methods described in the second aspect and any one of the second aspects above.
[0032] In a seventh aspect, this application provides a computer program product comprising instructions or a computer program, which, when run on a computer, causes the computer to perform the method described in any one of the first aspects above, or causes the computer to perform the method described in the second aspect above and any one of the second aspects above.
[0033] Eighthly, this application provides a communication system comprising: a first network device and a second network device, wherein the first network device is configured to perform the method described in the first aspect and any one of the first aspects above, and the second network device is configured to perform the method described in the second aspect and any one of the second aspects above. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1a A schematic diagram of a data flow provided for an embodiment of this application;
[0036] Figure 1b This application provides a schematic diagram of a data stream forwarding process.
[0037] Figure 1c A schematic diagram of yet another data flow provided in an embodiment of this application;
[0038] Figure 1d A schematic diagram illustrating a data stream out-of-order scenario provided in an embodiment of this application;
[0039] Figure 2 This is a schematic diagram illustrating an exemplary application scenario provided in an embodiment of this application;
[0040] Figure 3 A signaling interaction diagram of a communication method provided in an embodiment of this application;
[0041] Figure 4 A flowchart illustrating a communication method provided in an embodiment of this application;
[0042] Figure 5a This application provides a schematic diagram of a data stream forwarding process.
[0043] Figure 5b This is a schematic diagram illustrating another process for forwarding a data stream, as provided in an embodiment of this application.
[0044] Figure 5c This is a schematic diagram illustrating another process for forwarding a data stream, as provided in an embodiment of this application.
[0045] Figure 6 This is a schematic diagram of the structure of a communication device provided in an embodiment of this application;
[0046] Figure 7 This is a schematic diagram of the structure of another communication device provided in the embodiments of this application;
[0047] Figure 8 This is a schematic diagram of the structure of a device provided in an embodiment of this application. Detailed Implementation
[0048] This application provides a communication method and apparatus that can ensure that the data stream is not out of order when the forwarding path of the data stream is adjusted.
[0049] From a macro perspective, a data flow can include multiple flowlets, as shown in the reference. Figure 1a To understand, Figure 1a This is a schematic diagram of a data flow provided in an embodiment of this application. For example... Figure 1a As shown, a data stream comprises multiple stream segments, and each stream segment can include multiple messages, such as Transmission Control Protocol (TCP) packets. Currently, the forwarding path of a data stream can be adjusted based on these stream segments.
[0050] To make it easier to understand, we will first introduce the process of network devices forwarding data streams.
[0051] The network device stores two tables: path group entries and flow segment entries. Specifically:
[0052] The path group entry stores the path identifier, which can be the number of an end-to-end path. Alternatively, the path identifier can be other information that identifies a path; for example, if the path consists of only one hop, the path identifier could be the outgoing interface information and the next hop information. In some scenarios, the path group entry can be an equal cost multipath (ECMP) entry.
[0053] A flow segment entry is a table entry corresponding to a flow segment, which can store the path identifier. Each flow segment entry can include multiple entries, each used to store the path identifier. Additionally, each entry may include valid data indication information, indicating whether the entry contains valid data. When forwarding a data flow, the flow identifier of the data flow can be used as an index to determine the entry corresponding to that flow identifier. If the entry contains valid data, the path indicated by that entry can be used for packet forwarding. The valid data included in the entry is the identifier of the path included in that entry. The flow identifier can be obtained by hashing the N-tuples (e.g., quintuples) of the data flow.
[0054] The process of network devices forwarding data streams can be referenced. Figure 1b To understand, Figure 1b This is a schematic diagram illustrating a data stream forwarding process provided in an embodiment of this application. Figure 1bThe process shown includes steps 1 through 3 as follows.
[0055] Step 1: When the network device forwards the first packet of a data stream, it searches the flow segment table entry and uses the flow identifier of the data stream to index an entry in the flow segment table (e.g., entry1). At this time, entry1 contains no data (the valid data indication information for entry1 is 0, indicating that there is no valid data in entry1). It continues to search the path group table entry and selects path Link2 for packet forwarding. It also inserts the identifier of Link2 into the flow segment table entry. At this point, entry1 includes the identifier of Link2. Additionally, the valid data indication information for entry1 is modified to "v", indicating that entry1 contains valid data. Here, "v" is the first letter of the English word "valid". Although in Figure 1b In this context, "v" indicates that entry1 contains valid data. However, in other embodiments, other values (such as 1) may be used to indicate that entry1 contains valid data.
[0056] Regarding indexing an entry in a stream segment table using a stream identifier, it should be noted that in one example, the stream identifier is an integer, assuming the stream identifier is M, then the Mth entry in the stream segment table can be indexed.
[0057] Step 2: When subsequent packets arrive in this data stream, the flow identifier is still used to index entry1 in the flow segment table. At this time, entry1 includes the identifier for Link2, so the packet is forwarded via Link2. Additionally, the network device periodically sets the aging flag of entry1 (e.g., to 1). After forwarding the packet using Link2, the network device clears the aging flag of entry1 (e.g., sets the aging flag of entry1 to 0).
[0058] Step 3: The network device periodically queries the aging flag of each entry in the flow segment table. If the aging flag corresponding to an entry is not cleared within the timer interval, it means that this flowlet has ended, and this entry will be aged. Steps 1 to 3 will be repeated when the next flowlet of this flow arrives. For example, if the aforementioned entry1 is not cleared within the timer interval, the correspondence between the flow identifier of the data flow recorded in entry1 and the identifier of Link2 will be deleted.
[0059] Currently, when the time interval between two adjacent flowlets is relatively large, it is suitable to switch data flow forwarding paths based on flowlets. The time interval between two adjacent flowlets mentioned here refers to the time interval between when the network device receives these two flowlets. For example, in... Figure 1a In the scenario shown, assuming a large time interval between the first and second flowlets, the forwarding path of the data stream can be switched when the first flowlet ends. This way, when the new path is used to forward packets from the second flowlet, the packets on the old path (i.e., the packets included in the first flowlet) have already reached the destination device, thus preventing out-of-order data flow.
[0060] However, in some scenarios, such as intelligent computing services, the data flow is not uniform. Figure 1a As shown, there are significant time intervals between flowlets. Some data streams may be like... Figure 1c As shown, Figure 1c This is a schematic diagram of yet another data flow provided in an embodiment of this application. Figure 1c The data stream shown does not exhibit bursts of traffic, and the intervals between packets are relatively small. Therefore, it is impossible to reasonably divide this data stream into flowlets to switch the forwarding path of the data stream based on flowlets. Consequently, in these scenarios, if the forwarding path of the data stream is switched, it may lead to out-of-order data flow.
[0061] For reference Figure 1d To understand, Figure 1d This is a schematic diagram illustrating a data stream out-of-order scenario provided in an embodiment of this application. For example... Figure 1d As shown:
[0062] The network device initially forwards the data stream using path 1, where packets 1 through 5 are forwarded via path 1. Then, the network device switches the forwarding path from path 1 to path 2, and packets 6 through 2 are forwarded via path 2. Path 1 is heavily loaded; network device 1 needs to forward packets 100 through 104 via path 1 before forwarding packets 1 through 1 again. Path 2 is less loaded, and packet 6 is forwarded directly via path 2 without queuing. This results in packet 6 arriving at the destination device of the data stream before packet 1, causing out-of-order delivery of the data. Figure 1d In this context, message n refers to the message with message sequence number n, where n is a positive integer.
[0063] If data streams become out of order, the destination device needs to take appropriate measures, such as notifying the sender to retransmit the packets, which affects the quality of service provided to customers. Therefore, ensuring that data streams do not become out of order when the forwarding path is adjusted is a pressing issue that needs to be addressed.
[0064] In view of this, this application provides a communication method and apparatus that can ensure that the data stream does not become out of order when the forwarding path of the data stream is adjusted. Next, the communication method and apparatus provided in the embodiments of this application will be described in conjunction with the accompanying drawings.
[0065] See Figure 2 This figure is a schematic diagram of an exemplary application scenario provided by an embodiment of this application.
[0066] like Figure 2 As shown, User Equipment 1 can send data to User Equipment 2. The data sent by User Equipment 1 is transmitted to User Equipment 2 via Customer Premises Equipment (CPE), Network Equipment A, and the leaf and spine devices in the network.
[0067] Network device A, for example, may have AFR (Automatic Forwarding) technology enabled. After receiving a data stream from a CPE (Customer Premises Equipment), it can dynamically adjust the forwarding path of the data stream. In one example, the forwarding path used by network device A to forward the data stream may be calculated by the controller and sent to network device A.
[0068] User device 1 may be, for example, a terminal device or a server. User device 2 may also be a terminal device or a server; in one example, user device 2 may be, for example, a device in a smart computing center.
[0069] See Figure 3 This figure is a signaling interaction diagram of a communication method provided in an embodiment of this application.
[0070] Figure 3 The communication method shown can be applied, but is not limited to, to... Figure 2 The application scenario is shown. When Figure 3 The method shown is applied to Figure 2 In the scenario shown, Figure 3 The first network device in the middle can correspond to Figure 2 Network device A shown, Figure 3 The second network device shown can correspond to Figure 2 The CPE shown.
[0071] Figure 3 The method shown includes S101-S104.
[0072] S101: The first network device determines that the path for forwarding the first data stream by the first network device is switched from the first path to the second path.
[0073] In this application, a first network device can determine to switch its own path for forwarding the first data stream when the performance of forwarding the first data stream via the first path degrades. Specifically, the first network device can determine to switch its own path for forwarding the first data stream from the first path to a second path. In one example, the performance of forwarding the first data stream via the second path is better than that of forwarding the first data stream via the first path. For example, the latency of forwarding the first data stream via the second path is lower than the latency of forwarding the first data stream via the first path.
[0074] In one example, considering that an increase in the path load of the first path or congestion of the first path would lead to a decrease in the performance of forwarding the first data stream through the first path, the first network device may determine to switch its path for forwarding the first data stream from the first path to the second path when the path load of the first path increases or the first path becomes congested.
[0075] In one example, the path load on the first path increases, for example, by increasing the bandwidth utilization of the first path. In one example, the first network device can detect the bandwidth utilization of the first path to determine that the path load on the first path has increased. In another example, the controller can detect the bandwidth utilization of the first path and send the detection result to the first network device so that the first network device can determine that the path load on the first path has increased.
[0076] In one example, congestion occurs on the first path, for example, if the bandwidth utilization of the first path exceeds a certain threshold. In another example, the first network device can detect the bandwidth utilization of the first path to determine that the first path is congested. In yet another example, the controller can detect the bandwidth utilization of the first path and send the detection result to the first network device, so that the first network device can determine that the first path is congested.
[0077] S102: In response to determining that the path for forwarding the first data stream by the first network device has been switched from the first path to the second path, the first network device sends a notification message to the second network device. The notification message includes a pause duration, which instructs the second network device to stop sending the first data stream to the first network device within the pause duration. The pause duration is used to ensure that the packets in the first data stream received by the destination device of the first data stream are not out of order.
[0078] In this application, the performance of forwarding the first data stream via the second path is considered to be superior to that via the first path. For example, the latency of forwarding the first data stream via the second path is lower than that of forwarding it via the first path. Therefore, if the first network device immediately receives the first data stream from the second network device after determining that its forwarding path for the first data stream has switched from the first path to the second path, the received first data stream will be forwarded via the second path. This will result in... Figure 1d The phenomenon shown causes the first data stream to become out of order.
[0079] Therefore, in response to determining that the path for forwarding the first data stream has switched from the first path to the second path, the first network device may send a notification message to the second network device. This notification message instructs the second network device to suspend sending the first data stream to the first network device. Specifically, the notification message includes a pause duration, which instructs the second network device to stop sending the first data stream to the first network device during the pause duration.
[0080] In this application, the pause duration is used to ensure that the packets in the first data stream received by the destination device of the first data stream are not out of order. Here, "the packets in the first data stream received by the destination device are not out of order" means that the first data stream itself is not out of order.
[0081] This application does not specifically limit the pause duration, as long as the pause duration is sufficient to ensure that the first data stream does not become out of order. In one example, the pause duration can be determined based on the latency of the first path and the latency of the second path. As described above, the latency of the first path is greater than the latency of the second path. Assuming the difference between the latency of the first path and the latency of the second path is a first difference, then if the first network device forwards the first data stream through the first path and waits at least the first difference before forwarding the first data stream through the second path, the first data stream will not become out of order. Therefore, the pause duration can be greater than the difference between the latency of the first path and the latency of the second path.
[0082] In this application, the notification message may also include a stream identifier of the first data stream. This application does not specifically limit the stream identifier of the first data stream; in one example, the stream identifier of the first data stream may be calculated based on the N-tuple (e.g., quintuple) information of the first data stream.
[0083] This application does not specifically limit the notification message, which may include, but is not limited to, TCP messages, User Datagram Protocol (UDP) messages, or Internet Control Message Protocol (ICMP) messages.
[0084] S103: The second network device receives the notification message sent by the first network device.
[0085] S104: The second network device stops sending the first data stream to the first network device during the pause duration.
[0086] The second network device can receive the notification message sent by the first network device. After receiving the notification message, the second network device can parse the notification message and further stop sending the first data stream to the first network device during the pause duration. In one example, the second network device can cache the first data stream and send the cached first data stream to the first network device after the pause duration has elapsed.
[0087] Using the solution provided in this application embodiment, after the first network device determines that the path for forwarding the first data stream has switched from the first path to the second path, the second network device stops sending the first data stream to the first network device during the pause period. Therefore, the first network device will not immediately send the first data stream through the second path, thus avoiding out-of-order packets in the first data stream. In other words, using this solution, out-of-order packets in the first data stream can be avoided when the forwarding path of the first data stream is adjusted.
[0088] In this application, the first network device maintains a first flow table, wherein the first flow table contains entries at the data flow granularity. The first flow table is used to maintain the correspondence between the flow identifier of a data flow and the identifier of the path forwarding the data flow.
[0089] In one example, when a first network device determines that it will forward a first data stream via a first path, the first flow table includes the correspondence between the flow identifier of the first data stream and the identifier of the first path. After the first network device determines that the path it uses to forward the first data stream has changed from the first path to the second path, it can update the path identifier corresponding to the first data stream in the first flow table from the identifier of the first path to the identifier of the second path. That is, after the first network device determines that the path it uses to forward the first data stream has changed from the first path to the second path, it updates the information corresponding to the first data stream in the first flow table, and the updated first flow table includes the correspondence between the flow identifier of the first data stream and the identifier of the second path.
[0090] For information on the identifiers of the first and second paths, please refer to the description of path identifiers in the previous section; it will not be repeated here.
[0091] The first network device includes a control plane processing unit and a forwarding plane processing unit. The control plane processing unit is, for example, a central processing unit (CPU), a field-programmable gate array (FPGA), a network processor (NP), or an artificial intelligence chip. The forwarding plane processing unit is a forwarding chip, such as an NP-architecture chip or a pipeline architecture chip. In some scenarios, the forwarding plane processing unit may also be referred to as a data plane processing unit. In one example, the first flow table may be an entry sent by the control plane processing unit to the forwarding plane processing unit. In other words, after the control plane processing unit of the first network device determines that the path for forwarding the first data flow has changed from a first path to a second path, it updates the path identifier corresponding to the first data flow in the first flow table from the identifier of the first path to the identifier of the second path, and sends the updated first flow table to the forwarding plane processing unit.
[0092] In one example, the first network device maintains a second flow table, where the second flow table contains entries at the flow segment granularity. The second flow table can be, for example, the flow table maintained by the aforementioned forwarding plane processing unit. The second flow table includes multiple entries. For any given entry, it can correspond to one entry for storing the path identifier. Additionally, the entry includes corresponding valid data indication information to indicate whether the entry contains valid data. When forwarding the first data flow, the first network device first queries the second flow table using the flow identifier of the first data flow as an index. If the second flow table includes an entry corresponding to the flow identifier of the first data flow, forwarding is performed based on the entry in the second flow table corresponding to the flow identifier of the first data flow. If the second flow table does not include an entry corresponding to the flow identifier of the first data flow, the first network device further searches the first flow table to determine the path for forwarding the first data flow, and based on the determined path for forwarding the first data flow, creates an entry in the second flow table corresponding to the flow identifier of the first data flow. Wherein:
[0093] The second flow table includes an entry corresponding to the flow identifier of the first data flow, meaning that the entry in the second flow table, indexed by the flow identifier of the first data flow, contains valid data. Valid data in an entry refers to the identifier of the path included in the entry. Similarly, the second flow table does not include an entry corresponding to the flow identifier of the first data flow, meaning that the entry in the second flow table, indexed by the flow identifier of the first data flow, does not contain valid data.
[0094] For the second flow table, the entry corresponding to the flow identifier of the first data flow has an aging flag, which the first network device periodically sets (e.g., to 1). Additionally, each time the first network device uses the entry in the second flow table corresponding to the flow identifier of the first data flow to determine the path for forwarding the first data flow, the first network device clears the aging flag. Furthermore, the first network device periodically queries the aging flag; if the aging flag is not cleared within a timer interval, the entry in the second flow table corresponding to the flow identifier of the first data flow is deleted.
[0095] When the first network device forwards the first data stream through the first path, the entry in the second flow table corresponding to the flow identifier of the first data stream includes the identifier of the first path.
[0096] In one example, after the first network device sends a notification message to the second network device, the second network device suspends sending the first data stream to the first network device for a pause period. Therefore, the first network device will not use the entry in the second flow table corresponding to the flow identifier of the first data stream to determine the path for forwarding the first data stream for a certain period. Consequently, the aging flag of the entry in the second flow table corresponding to the flow identifier of the first data stream will not be cleared, resulting in the aging flag not being cleared within the timer interval. Accordingly, the first network device will delete the entry in the second flow table corresponding to the flow identifier of the first data stream. Specifically, the first network device will delete the data in the entry in the second flow table indexed by the flow identifier of the first data stream. As described above, the data mentioned here refers to the identifier of the first path. Additionally, the first network device can also modify the valid data indication information of the entry in the second flow table corresponding to the flow identifier of the first data stream, for example, by changing the value of the valid data indication information to 0 to indicate that there is no valid data in the entry after the modification.
[0097] In one example, before the entry corresponding to the flow identifier of the first data flow in the second flow table is deleted, for a second packet belonging to the first data flow that the first network device is to forward, the first network device can query the second flow table through the flow identifier of the first data flow to obtain the identifier of the first path, and further forward the second packet through the first path.
[0098] As described above, in one example, the second network device can continue sending the first data stream to the first network device after the pause duration has elapsed. In this case, the first network device can also perform... Figure 4 S201-S203 are shown. Figure 4 This is a flowchart illustrating a communication method provided in an embodiment of this application.
[0099] S201: The first network device receives a first message sent by the second network device, the first message belonging to the first data stream.
[0100] S202: The first network device uses the flow identifier of the first data stream to query the first flow table to obtain the identifier of the second path.
[0101] S203: The first network device forwards the first packet through the second path.
[0102] In this application, the first message is a message included in the first data stream sent by the second network device to the first network device after the aforementioned pause duration has elapsed. After receiving the first message, the first network device can use the flow identifier of the first data stream to query the first flow table to determine the path for forwarding the first message. As described above, after determining that its forwarding path for the first data stream has switched from the first path to the second path, the first network device updates the first flow table. The updated first flow table includes the flow identifier of the first data stream and the identifier of the second path. Therefore, by querying the first flow table using the flow identifier of the first data stream, the first network device can obtain the identifier of the second path. After obtaining the identifier of the second path, the first network device can forward the first message through the second path.
[0103] As described above regarding the second flow table, when determining the path for forwarding a packet, the first network device first queries the second flow table indexed by the flow identifier of the data flow. If no corresponding entry is found in the second flow table, it further queries the first flow table to determine the path for forwarding the packet. Therefore, in one example, before querying the first flow table using the flow identifier of the first data flow, the first network device can also query the second flow table using the flow identifier of the first data flow. As described above, since the entry in the second flow table corresponding to the flow identifier of the first data flow has been deleted, the first network device can determine that the second flow table does not include an entry corresponding to the flow identifier of the first data flow when querying the second flow table using the flow identifier of the first data flow. In this case, the first network device can further query the first flow table to determine the path for forwarding the first packet even if the second flow table does not include an entry corresponding to the flow identifier of the first data flow. In this case:
[0104] After the first network device queries the first flow table to determine that the first packet will be forwarded via the second path, it can create an entry in the second flow table corresponding to the flow identifier of the first data flow. This created entry includes the identifier of the second path. After the first network device creates the entry in the second flow table corresponding to the flow identifier of the first data flow, the second flow table will include an entry corresponding to the flow identifier of the first data flow, and this entry will include the identifier of the second path. Thus, when the first network device subsequently needs to forward a third packet from the first data flow, it can query the second flow table using the flow identifier of the first data flow as an index to obtain the identifier of the second path, thereby forwarding the third packet via the second path.
[0105] Specifically, in the implementation of the first network device creating an entry corresponding to the flow identifier of the first data flow in the second flow table, the first network device can first use the flow identifier of the first data flow as an index to determine the entry in the second flow table corresponding to the flow identifier of the first data flow. Further, the identifier of the second path is stored in the entry. In addition, the first network device also modifies the data indication information corresponding to the entry. The modified valid data indication information indicates that the entry includes valid data.
[0106] The communication method provided in the embodiments of this application has been described above. Next, in conjunction with... Figures 5a to 5c This paper introduces one possible implementation scheme of the embodiments of this application.
[0107] See Figure 5a , Figure 5a This is a schematic diagram illustrating a data stream forwarding process provided in an embodiment of this application. Figure 5a The method shown is applied to the first network device mentioned in the above embodiments. Figure 5aThe process shown includes the following steps 1' to 2'.
[0108] Step 1': The first network device selects a path (Link2) from the path group table as the path for forwarding the first data flow and generates the corresponding first flow table. For example... Figure 5a As shown, the first flow table includes the flow ID of the first data flow and the identifier of Link2. Figure 5a In this context, Link2 represents the identifier of Link2. After the first packet of the first data flow arrives at the first network device, the first network device looks up the first flow table to obtain the identifier of Link2 and forwards the packet through Link2. Additionally, the first network device uses the flow ID in the first flow table as an index to look up the second flow table; at this point, there is no entry for that flow ID in the second flow table.
[0109] Step 2': The first network device retrieves Link2 and flow ID from the first flow table, uses the flow ID as an index to determine the entry corresponding to that flow ID in the second flow table, and adds the Link2 identifier to the entry corresponding to that flow ID. Furthermore, it modifies the valid data indication information corresponding to that entry to "v".
[0110] After subsequent packets of the first data stream arrive at the first network device, the first network device looks up the first flow table to obtain the flow ID of the first data stream, and then uses the flow ID of the first data stream to look up the second flow table to obtain the identifier of Link2. Further, the device forwards the packets through Link2. Additionally, the first network device clears the aging flag of the entry corresponding to the first data stream in the second flow table.
[0111] When congestion occurs on Link2, the first network device determines to change the path for forwarding the first data stream from Link2 to Link3. Then, the first network device can execute... Figure 5b The process is shown below. Figure 5b This is a schematic diagram illustrating another process of forwarding a data stream, as provided in an embodiment of this application. Figure 5b The process shown includes steps 3' to 4' as follows.
[0112] Step 3': The first network device first updates the data in the first flow table, changing the identifier of Link2 to the identifier of Link3. Additionally, the first network device sends a notification message to the second network device, carrying the pause duration. At this point, the flow ID of the first data flow can still be used to find the entry in the second flow table corresponding to the flow identifier of the first data flow, and the packet (e.g., the second packet) is sent from Link2.
[0113] Step 4': Because the second network device suspends sending the first data stream to the first network device, the entry corresponding to the flow identifier of the first data stream in the second flow table is aged out. That is, the entry in the second flow table corresponding to the flow identifier of the first data stream is aged out.
[0114] After the pause period expires, the second network device continues to send the first data stream to the first network device. The first network device can then execute... Figure 5c The process shown is as follows: Figure 5c This is a schematic diagram illustrating another process of forwarding a data stream, as provided in an embodiment of this application. Figure 5c The process shown includes the following step 5'.
[0115] Step 5': For the packet received by the first network device (e.g., the first packet). The first network device first queries the second flow table using the flow ID of the first data flow, but no corresponding entry is found. Further, the first network device queries the first flow table to obtain the Link3 identifier, and then forwards the packet via Link3. Additionally, the first network device inserts the Link3 identifier into the entry in the second flow table corresponding to the first data flow, and modifies the valid data indication information corresponding to that entry to "v".
[0116] Furthermore, for packets belonging to the first data stream subsequently received by the first network device, the flow identifier of the first data stream is used as an index for querying. Figure 5c The updated second flow table shown is used to obtain the Link3 identifier, thereby forwarding packets through Link3.
[0117] Based on the methods provided in the above embodiments, this application also provides a corresponding device. The device provided in this application will be described below with reference to the accompanying drawings.
[0118] See Figure 6 The figure is a schematic diagram of the structure of a communication device provided in an embodiment of this application. Figure 6 The communication device 600 shown is applied to a first network device and is used to execute the method provided in the above embodiments by the first network device, for example, executing... Figure 3 The steps shown are performed by the first network device, for example, executing... Figure 4 The method shown.
[0119] like Figure 6 As shown, the device 600 includes a processing unit 601 and a sending unit 602.
[0120] The processing unit 601 is used to determine that the path for the first network device to forward the first data stream is switched from the first path to the second path.
[0121] The sending unit 602 is configured to send a notification message to the second network device in response to determining that the path for forwarding the first data stream by the first network device has been switched from the first path to the second path. The notification message includes a pause duration, which instructs the second network device to stop sending the first data stream to the first network device within the pause duration. The pause duration is used to ensure that the packets in the first data stream received by the destination device of the first data stream are not out of order.
[0122] In one possible implementation, the pause duration is greater than the difference between the delay of the first path and the delay of the second path.
[0123] In one possible implementation, the processing unit 601 is further configured to: in response to determining that the path for forwarding the first data stream by the first network device has been switched from the first path to the second path, update the path identifier corresponding to the first data stream in the first flow table from the identifier of the first path to the identifier of the second path.
[0124] In one possible implementation, the processing unit 601 is further configured to: delete the entry in the second flow table corresponding to the flow identifier of the first data flow.
[0125] In one possible implementation, the apparatus further includes: a receiving unit, configured to receive a first packet sent by the second network device after deleting the entry in the second flow table corresponding to the flow identifier of the first data flow, wherein the first packet belongs to the first data flow; the processing unit 601 is further configured to: query the first flow table using the flow identifier of the first data flow to obtain the identifier of the second path; and the sending unit 602 is further configured to forward the first packet through the second path.
[0126] In one possible implementation, the processing unit 601 is further configured to query the second flow table using the flow identifier of the first data stream before querying the first flow table using the flow identifier of the first data stream, and determine that the second flow table does not include the entry corresponding to the flow identifier; the processing unit 601 is configured to query the first flow table using the flow identifier of the first data stream, specifically including: the processing unit 601 is configured to query the first flow table using the flow identifier of the first data stream in response to determining that the second flow table does not include the entry corresponding to the flow identifier.
[0127] In one possible implementation, the processing unit 601 is further configured to: create an entry in the second flow table corresponding to the flow identifier of the first data flow, wherein the created entry includes: the identifier of the second path.
[0128] In one possible implementation, the processing unit 601 is further configured to query the second flow table using the flow identifier of the first data stream before deleting the table entry stored in the second flow table corresponding to the flow identifier of the first data stream, and obtain the identifier of the first path; the sending unit 602 is further configured to forward the second packet through the first path, the second packet belonging to the first data stream.
[0129] In one possible implementation, the processing unit 601 is used to determine that the path for the first network device to forward the first data stream is switched from the first path to the second path. Specifically, the processing unit 601 is used to determine that when the path load of the first path increases or the first path becomes congested, the path for the first network device to forward the first data stream is switched from the first path to the second path.
[0130] See Figure 7 The figure is a schematic diagram of another communication device provided in an embodiment of this application. Figure 7 The communication device 700 shown is applied to a second network device to execute the method provided in the above embodiments, which is performed by the second network device, for example, executing... Figure 3 The steps shown are performed by the second network device.
[0131] like Figure 7 As shown, the device 700 includes a receiving unit 701 and a processing unit 702.
[0132] The receiving unit 701 is used to receive a notification message sent by the first network device. The notification message includes a pause duration, which instructs the second network device to stop sending the first data stream to the first network device within the pause duration. The pause duration is used to ensure that the packets in the first data stream received by the destination device of the first data stream are not out of order.
[0133] The processing unit 702 is configured to stop sending the first data stream to the first network device during the pause duration.
[0134] In one possible implementation, the pause duration is greater than the difference between the delay of the first path and the delay of the second path.
[0135] In one possible implementation, the apparatus further includes: a sending unit, configured to send a first message to the first network device after the duration of the pause in sending the first data stream to the first network device reaches the pause duration, wherein the first message belongs to the first data stream.
[0136] For the specific implementation of each unit of the devices 600 and 700, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.
[0137] In this application, the hardware structure of the aforementioned communication devices 600 and 700 can be as follows: Figure 8 The structure shown, Figure 8 This is a schematic diagram of the structure of a device provided in an embodiment of this application.
[0138] Please see Figure 8 As shown, device 800 includes: a processor 810, a communication interface 820, and a memory 830. The number of processors 810 in device 800 can be one or more. Figure 8 Taking a processor as an example. In this embodiment, the processor 810, communication interface 820, and memory 830 can be connected via a bus system or other means, wherein, Figure 8 Taking the connection between China and Israel via the 840 bus system as an example.
[0139] Processor 810 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP. Processor 810 may further include hardware chips. These hardware chips may be application-specific integrated circuits (ASICs), programmable logic devices (PLDs), or combinations thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0140] Memory 830 may include volatile memory, such as random-access memory (RAM); memory 830 may also include non-volatile memory, such as flash memory, hard disk drive (HDD), or solid-state drive (SSD); memory 830 may also include combinations of the above types of memory. Figure 8When the device 800 shown is a first network device, the memory 830 can, for example, be used to store the aforementioned first flow table and second flow table; when Figure 8 When the device 800 shown is a second network device, the memory 830 can be used, for example, to store the aforementioned pause duration.
[0141] Optionally, the memory 830 stores an operating system and programs, executable modules, or data structures, or subsets thereof, or extended sets thereof. The programs may include various operation instructions for implementing various operations. The operating system may include various system programs for implementing various basic services and handling hardware-based tasks. The processor 810 can read the programs in the memory 830 to implement the communication methods provided in the embodiments of this application.
[0142] The bus system 840 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus system 840 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0143] This application also provides a computer-readable storage medium, including instructions or a computer program, which, when run on a computer, causes the computer to perform the communication methods provided in the above embodiments. For example, it causes the computer to perform the method steps provided in the above embodiments executed by a first network device; or, for example, it causes the computer to perform the method steps provided in the above embodiments executed by a second network device.
[0144] This application also provides a computer program product comprising instructions or a computer program, which, when run on a computer, causes the computer to execute the communication methods provided in the above embodiments. For example, it causes the computer to execute the method steps provided in the above embodiments executed by a first network device; or, for example, it causes the computer to execute the method steps provided in the above embodiments executed by a second network device.
[0145] This application also provides a communication system, which includes the first network device and the second network device mentioned in the above embodiments. The first network device is used to perform the operations performed by the first network device provided in the above embodiments, and the second network device is used to perform the operations performed by the second network device provided in the above embodiments.
[0146] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0147] The embodiments of this application have been described in detail above. The steps in the method of the embodiments of this application can be scheduled, merged or deleted in sequence according to actual needs; the modules in the device of the embodiments of this application can be divided, merged or deleted according to actual needs.
[0148] It should be understood that the phrase "an embodiment" or "one embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in one embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence number of the above-described processes does not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0149] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0150] It should be understood that in the embodiments of this application, "B corresponding to A" means that B is associated with A, and B can be determined based on A. However, it should also be understood that determining B based on A does not mean that B is determined solely based on A; B can also be determined based on A and / or other information.
[0151] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0152] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0153] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0154] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
Claims
1. A communication method, characterized in that, The method is applied to a first network device, and the method includes: The path for the first network device to forward the first data stream is changed from the first path to the second path; In response to determining that the path for forwarding the first data stream by the first network device has switched from the first path to the second path, a notification message is sent to the second network device. The notification message includes a pause duration, which instructs the second network device to stop sending the first data stream to the first network device during the pause duration. The pause duration is used to ensure that the packets in the first data stream received by the destination device of the first data stream are not out of order.
2. The method according to claim 1, characterized in that, The pause duration is greater than the difference between the delay of the first path and the delay of the second path.
3. The method according to claim 1 or 2, characterized in that, The method further includes: In response to determining that the path for forwarding the first data stream by the first network device has been switched from the first path to the second path, the path identifier corresponding to the first data stream in the first flow table is updated from the identifier of the first path to the identifier of the second path.
4. The method according to claim 3, characterized in that, The method further includes: Delete the entry in the second flow table that corresponds to the flow identifier of the first data flow.
5. The method according to claim 4, characterized in that, After deleting the entry in the second stream table corresponding to the stream identifier of the first data stream, the method further includes: Receive a first message sent by the second network device, wherein the first message belongs to the first data stream; The identifier of the second path is obtained by querying the first flow table using the flow identifier of the first data stream. The first message is forwarded via the second path.
6. The method according to claim 5, characterized in that, Before querying the first flow table using the flow identifier of the first data stream, the method further includes: The second flow table is queried using the flow identifier of the first data stream, and it is determined that the second flow table does not include the entry corresponding to the flow identifier; Querying the first flow table using the flow identifier of the first data stream includes: In response to determining that the second flow table does not contain an entry corresponding to the flow identifier, the first flow table is queried using the flow identifier of the first data flow.
7. The method according to claim 5 or 6, characterized in that, The method further includes: Create an entry in the second flow table corresponding to the flow identifier of the first data flow, wherein the created entry includes: the identifier of the second path.
8. The method according to any one of claims 4-7, characterized in that, Before deleting the entry in the second flow table corresponding to the flow identifier of the first data flow, the method further includes: The identifier of the first path is obtained by querying the second flow table using the flow identifier of the first data stream. The second message is forwarded through the first path, and the second message belongs to the first data stream.
9. The method according to any one of claims 1-8, characterized in that, The step of determining that the path for forwarding the first data stream by the first network device is switched from the first path to the second path includes: When the path load of the first path increases or the first path becomes congested, the path for the first network device to forward the first data stream is switched from the first path to the second path.
10. A communication method, characterized in that, Applied to a second network device, the method includes: The second network device receives a notification message sent by a first network device, the notification message including a pause duration, the pause duration instructing the second network device to stop sending the first data stream to the first network device within the pause duration, the pause duration being used to ensure that the packets in the first data stream received by the destination device of the first data stream are not out of order; During the pause duration, the transmission of the first data stream to the first network device is stopped.
11. The method according to claim 10, characterized in that, The pause duration is greater than the difference between the delay of the first path and the delay of the second path.
12. The method according to claim 10 or 11, characterized in that, The method further includes: After the duration of the pause in sending the first data stream to the first network device reaches the pause duration, a first message is sent to the first network device, the first message belonging to the first data stream.
13. A communication device, characterized in that, The device includes multiple functional modules that interact with each other to implement the method as described in any one of claims 1-12.
14. A communication device, comprising a processor and a memory, the memory for storing program code, the processor for calling the program code in the memory to cause the communication device to perform the method as described in any one of claims 1-12.
15. A computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-12.
16. A computer program product, characterized in that, Includes program code that, when a computer runs the computer program product, causes the computer to perform the method as described in any one of claims 1-12.
17. A communication system, characterized in that, The system includes: A first network device that performs the method according to any one of claims 1-9, and a second network device that performs the method according to any one of claims 10-12.