Data message transmission method, program product and storage medium

By adding routing device identifiers and outgoing port identifiers to data packets, fast routing path switching is achieved, solving the problem of resource consumption during routing path switching in existing technologies, and achieving the effects of saving resources and fast switching.

CN121125608APending Publication Date: 2025-12-12ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410748157.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

The existing routing notification mechanism suffers from the problem of consuming a large amount of switch resources when switching routing paths.

Method used

Upon receiving a data packet, if multiple outgoing ports are identified by querying the forwarding table entries of the routing device, the device identifier of the routing device and the port identifier of the target outgoing port are added to the data packet, and then transmitted to the next routing device through the target outgoing port, thereby achieving fast routing path switching.

Benefits of technology

This solves the problem of routing path switching consuming a large amount of switch resources, and enables fast and efficient routing path switching, saving resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121125608A_ABST
    Figure CN121125608A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data message transmission method, a program product and a storage medium, and the method comprises the steps: receiving a first data message; and under the condition that a plurality of first output ports are queried from a first forwarding table item of the first routing equipment, adding a first equipment identifier of the first routing equipment and a port identifier of a first target output port into a first message of the first data message to obtain a second data message, the plurality of first output ports are ports allowing forwarding of the first data message, and the first target output port is a message forwarding output port selected from the plurality of first output ports; and transmitting the second data message to the second routing equipment through the first target output port. Through the routing path switching method and device, the problem that a large number of switch resources are consumed during routing path switching in the prior art is solved, and the effects of saving resources and rapidly switching the routing path are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data transmission, and more specifically, to a data packet transmission method and program product, and a storage medium. Background Technology

[0002] As networks continue to expand, network devices become more functional and network topologies become more diverse, making network device management increasingly complex for administrators. One important task in network management is to establish routing notification mechanisms for network devices.

[0003] In the existing routing notification mechanism, local records need to be recorded and returned along the route, and the remote routing node needs to switch paths, which can consume a lot of switch resources. Summary of the Invention

[0004] This application provides a data packet transmission method, program product, and storage medium to at least solve the problem in related technologies where switching routing paths consumes a large amount of switch resources.

[0005] According to one embodiment of this application, a method for transmitting data packets is provided, comprising: receiving a first data packet; when multiple first outgoing ports are found in a first forwarding table entry of a first routing device, adding a first device identifier of the first routing device and a port identifier of a first target outgoing port to a first packet of the first data packet to obtain a second data packet, wherein the multiple first outgoing ports are ports that are allowed to forward the first data packet, and the first target outgoing port is a packet forwarding port selected from the multiple first outgoing ports; and transmitting the second data packet to a second routing device through the first target outgoing port.

[0006] According to another embodiment of this application, a data packet transmission apparatus is provided, comprising: a first receiving module for receiving a first data packet; a first adding module for adding a first device identifier of the first routing device and a port identifier of a first target outgoing port to a first packet of the first data packet, wherein, when multiple first outgoing ports are found in a first forwarding table entry of a first routing device, a second data packet is obtained, wherein the multiple first outgoing ports are ports that are allowed to forward the first data packet, and the first target outgoing port is a packet forwarding port selected from the multiple first outgoing ports; and a first transmission module for transmitting the second data packet to a second routing device through the first target outgoing port.

[0007] According to yet another embodiment of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.

[0008] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.

[0009] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0010] This application addresses the issue that, upon receiving a first data packet, the first routing device queries its forwarding port in its first forwarding table. If multiple first outgoing ports are found, the first device identifier of the first routing device and the port identifier of the determined first target outgoing port are added to the first data packet. The second data packet is then transmitted to the second routing device via the first target outgoing port. This allows for rapid identification of a suitable routing device for switching routes in the event of congestion or a fault, based on the device identifier and outgoing port identifier carried in the data packet. Therefore, this solves the problem of excessive switch resources being consumed when switching routes in related technologies, achieving resource savings and rapid route switching. Attached Figure Description

[0011] Figure 1 This is a hardware structure block diagram of a mobile terminal for a data packet transmission method according to an embodiment of this application.

[0012] Figure 2 This is a flowchart of a data packet transmission method according to an embodiment of this application;

[0013] Figure 3 This is a schematic diagram of the routing path according to an embodiment of the present invention;

[0014] Figure 4 This is a schematic diagram of the network layer of a routing device according to an embodiment of the present invention;

[0015] Figure 5 This is a structural block diagram of a data packet transmission apparatus according to an embodiment of this application. Detailed Implementation

[0016] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0017] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0018] The methods and embodiments provided in this application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a data packet transmission method according to an embodiment of this application. For example... Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0019] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the data packet transmission method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0020] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0021] This embodiment provides a method for transmitting data packets. Figure 2 This is a flowchart of a data packet transmission method according to an embodiment of this application, such as... Figure 2As shown, the process includes the following steps:

[0022] Step S202: Receive the first data packet;

[0023] In one exemplary embodiment, the first data packet can be a data unit transmitted in a computer network, including a source data packet and a first packet (e.g., a packet header). The source data packet can be information in the form of text, images, audio, or video. The first packet can include information about the source data, such as data volume and data type, and can also include routing path information, such as the device identifier of the source routing device and the outgoing port identifier. The first data packet can also be divided into small data packets, each containing its own message information, and transmitted to the destination through the network. The data packets can be transmitted via network communication protocols, such as Transmission Control Protocol (TCP) / Internet Protocol (IP) protocols, where TCP / IP includes Transmission Control Protocol TCP and Internet Protocol (IP). TCP is responsible for reliable data transmission, while IP is responsible for data routing and transmission.

[0024] Step S204: If multiple first outgoing ports are found in the first forwarding table entry of the first routing device, the first device identifier of the first routing device and the port identifier of the first target outgoing port are added to the first packet of the first data packet to obtain the second data packet. The multiple first outgoing ports are ports that are allowed to forward the first data packet, and the first target outgoing port is the packet forwarding port selected from the multiple first outgoing ports.

[0025] In one exemplary embodiment, a first routing device refers to a device capable of transmitting data packets and determining transmission paths within a computer network. It is used to connect multiple computers or network devices, facilitating communication and data transmission within the network. The first routing device can be a physical device, such as a router or switch, or a software program, such as a router operating system. A first forwarding table entry can be a table recording outgoing port information from the first routing device. It is used to determine the path for data packets to be transmitted from the first routing device to other routing devices. Each routing device maintains one forwarding table entry. Furthermore, the first forwarding table entry may also include the destination network address, next-hop address, the outgoing port that the first data packet should use when leaving the current router, the routing type, etc.

[0026] For example, such as Figure 3The diagram shows a routing network using a fat tree topology, comprising multiple switches. Each switch has its local ports numbered SW1-SW10. For example, SW7 is connected to SW4 via port 7-4, SW4 is connected to SW2 via port 4-2, and so on. Each switch is configured with a loopback address, which is routable. For instance, SW7 queries its locally stored forwarding table to obtain the corresponding next-hop routing device and outgoing port information. For this packet, SW7 has another available, non-congested port, port 7-3, in addition to its direct connection to SW4 via port 7-4. SW7 fills the packet with its routing device identifier and the port identifier of port 7-4, and forwards the packet to SW4.

[0027] Fat tree topology is a network topology used in data centers. It features multiple layers of switches, providing high bandwidth and low latency connectivity. In a Fat tree topology, the network is divided into multiple layers, each with multiple switches. Layers are connected via multiple links, forming a tree-like network structure. Key features of Fat tree topology include: High bandwidth: Due to the multiple links connecting upper and lower layer switches, it provides high-bandwidth communication capabilities, suitable for data center applications requiring large amounts of data transmission. Low latency: Parallel transmission through multiple links reduces data transmission latency and improves network response speed. Redundancy: Because of the multiple links, if one link fails, the network can continue communication through other links, improving network reliability. Scalability: The Fat tree topology can be expanded as needed, adding more switches and links to meet the growing demands of data centers. Networks using Fat tree topology offer high performance, high reliability, and flexible scalability, making them suitable for large-scale data center networks.

[0028] Step S206: Transmit the second data packet to the second routing device through the first destination output port.

[0029] In one exemplary embodiment, the second routing device is of the same type as the first routing device described above, and will not be described again here. The second data packet is of the same type as the first data packet described above, and will not be described again here.

[0030] This embodiment includes, but is not limited to, scenarios where data packets need to be routed and forwarded, such as... Figure 3 The example shown illustrates a data forwarding scenario within a Fat tree topology.

[0031] The entity executing the above steps can be a terminal, a server, a specific processor configured in the terminal or server, or a processor or processing device configured relatively independently of the terminal or server, but is not limited to these. For example, the entity executing the steps can be a first routing device.

[0032] Through the above steps, when the first routing device receives the first data packet, it queries the first forwarding table entry for the forwarding port of the first data packet. If multiple first outgoing ports are found, the first device identifier of the first routing device and the port identifier of the determined first destination outgoing port are added to the first data packet. The second data packet is then transmitted to the second routing device through the first destination outgoing port. This allows for the rapid identification of a routing device that can switch routing paths in the event of congestion or a fault, based on the device identifier and outgoing port identifier carried in the data packet. Therefore, this solves the problem of excessive switch resources being consumed when switching routing paths in related technologies, achieving the effect of saving resources and quickly switching routing paths.

[0033] In an exemplary implementation, when multiple first outgoing ports are found from the first forwarding table entry of the first routing device, before adding the first device identifier of the first routing device and the port identifier of the first target outgoing port of the first target outgoing port to the first packet of the first data packet to obtain the second data packet, the method further includes one of the following:

[0034] When the amount of data in the original data packet in the first data packet is greater than the first preset data amount, the first identification information is set in the first packet. The first identification information is used to identify the first data packet as a data packet that requires adaptive routing. Adaptive routing is used to indicate the function of switching the first data packet to other paths that meet the forwarding conditions when the current forwarding path does not meet the forwarding requirements of the first data packet.

[0035] If the amount of data in the original data packet in the first data packet is less than the second preset data amount, or if the type of the original data packet in the first data packet is a preset type, a second identification information is set in the first packet, wherein the second identification information is used to identify the original data packet as a data packet that does not require adaptive routing.

[0036] In one exemplary implementation, not all data packets require routing path switching. For example, if congestion occurs during data packet transmission, switching the routing path of small data streams (e.g., a "mouse stream") may not significantly alleviate the congestion. Switching larger data streams (e.g., an "elephant stream") to other paths might be sufficient to alleviate the congestion. Furthermore, for some functional packets, such as detection or real-time packets, whose purpose is to detect path quality and identify bottlenecks, the original path must be maintained, and routing path switching should not be performed. Therefore, the data volume of the data packet needs to be determined before forwarding it.

[0037] Optionally, the first preset data volume can be the data volume of an elephant stream, for example, a data volume exceeding 1TB. The second preset quantity can be the data volume of a mouse stream, for example, a data volume less than 10GB. In this embodiment, when the data volume of the original data packet in the first data packet is greater than the first preset data volume, a first identification information is set in the first packet. The main purpose is to identify the first data packet as a data packet requiring adaptive routing. For a pair of source and destination nodes, adaptive routing can have multiple paths available depending on the network's operating state, thus offering advantages such as high flexibility, high network channel utilization, and strong network fault tolerance. After a congestion or fault event (referred to as an AR event in this embodiment) occurs, if the local routing device has no switchable path, or the switch does not meet the requirements, the local routing device generates an Adaptive Routing Notification (ARN) message to notify the upstream node, which then switches the forwarding path to bypass the congestion or fault point. If the directly connected upstream node still does not meet the path switching requirements, a further upstream node needs to perform the path switching.

[0038] In one exemplary embodiment, packets requiring adaptive routing are tagged with a first identification information. Routing devices along the route recognize this first identification information, and only tagged data packets will undergo routing switching in the event of congestion or a fault. The first identification information can be added to the data packet by the end-side device (e.g., a host, network interface card, etc.) or by the access-side switch based on the packet type. For example, if the access-side switch identifies the traffic as elephant traffic, it will tag the corresponding packet. Data packets not requiring adaptive routing are tagged with a second identification information. Routing devices along the route will only perform routing switching for untagged data packets in the event of congestion or a fault. The second identification information can also be added to the data packet by the end-side device (e.g., a host, network interface card, etc.) or by the access-side switch based on the packet type. For example, if the access-side switch identifies the traffic as detection packets, it will tag the corresponding packet.

[0039] This embodiment can quickly identify whether a data packet has adaptive routing capabilities by setting identification information in the data packet to indicate the amount of data, thereby accurately controlling the transmission of the data packet.

[0040] In an exemplary embodiment, if multiple first outgoing ports are found in the first forwarding table entry of the first routing device, the first device identifier of the first routing device and the port identifier of the first target outgoing port are added to the first packet of the first data packet to obtain a second data packet, including:

[0041] If multiple first outgoing ports are found from the first forwarding table entry, the first device identifier and the port identifier of the first target outgoing port are added to the first packet to obtain the second data packet; or, if multiple first outgoing ports are found from the first forwarding table entry, and the first packet also includes other device identifiers and the port identifiers of other first target outgoing ports, the first device identifier and the port identifier of the first target outgoing port are added to the first packet to replace the other device identifiers and the port identifiers of other first target outgoing ports to obtain the second data packet. Here, the other device identifier is the identifier of another routing device that transmits the first data packet through another first target outgoing port before the first routing device, and the other routing device includes multiple other ports that are allowed to transmit the first data packet. The other first target outgoing ports are determined from multiple other ports, and the port identifier of the other first target outgoing ports is the identifier of the other first target outgoing ports.

[0042] In an exemplary embodiment, when the first routing device is a source routing device, the first routing device needs to identify the data volume of the original data packet in the first data packet. If the original data packet is an elephant stream, it sets first identification information and then searches for the outgoing port for forwarding the first data packet in the first forwarding table entry. If multiple outgoing ports are found, the first target outgoing port is determined from the multiple outgoing ports, and the port identifier of the first target outgoing port and the device identifier of the first routing device are set in the first packet to obtain the second packet. For example, as shown... Figure 3As shown, the first data packet is sent from SW7 to SW10. The first routing device is the ingress switch SW7. SW7 identifies the original data packet in the first data packet as an elephant flow and marks all sub-data packets belonging to the first data packet with an AR tag (i.e., first identification information) that enables adaptive routing. The AR tag can be set in the MAC frame, IP header, or transport layer protocol header of the first data packet. During a certain period, for a certain flowlet belonging to the first data packet, the path is SW7-SW4-SW2-SW6-SW10. During the forwarding of the first data packet, SW7 queries its local table to obtain the corresponding next-hop routing device and outgoing port information. For the first data packet, in addition to port 7-4 which is directly connected to SW4, SW7 also has another uncongested available port 7-3. That is, SW7 has AR capability (i.e., adaptive routing capability) for this packet. SW7 fills the packet with the switch identifier of SW7 (the switch address in this embodiment) and the ID of the outgoing port port 7-4 that the packet is forwarded by this device to obtain the second data packet, and forwards the second data packet to SW4.

[0043] In an exemplary embodiment, if the first routing device is not the source routing device, the first routing device needs to identify the identification information in the first packet. If the identification information is the first identification information, it searches for the outgoing port for forwarding the first data packet in the first forwarding table entry. For example, such as Figure 3 As shown, the first routing device is the intermediate routing device SW4. After receiving the first data packet, SW4 first identifies that the first packet carries an AR tag (i.e., first identification information). Therefore, it queries the local first forwarding table entry to obtain the corresponding next hop and outgoing port information. For this first data packet, in addition to the port 4-2 directly connected to SW2, SW4 also has another uncongested available port, that is, it has AR capability for this first data packet. Then, SW4 replaces the switch identifier and outgoing port identifier information in the first data packet with the switch address of SW4, respectively, to obtain the second data packet and the outgoing port ID of the second data packet that is forwarded by this device, port 4-7. SW4 then forwards the second data packet to SW2.

[0044] This embodiment determines whether the outgoing routing device has multiple outgoing ports by judging the identification information carried in the data packet and querying the local forwarding table entries based on the identification information. This allows for quick identification of the target outgoing port, and the outgoing port's identifier and device identifier can be set in the data packet.

[0045] In one exemplary embodiment, this embodiment may select a first target output port from a plurality of output ports based on the following conditions:

[0046] Bandwidth: First, consider the bandwidth of the output port. Choosing an output port with greater bandwidth can provide higher data transmission speed and performance.

[0047] Latency: Latency is an important indicator in the data transmission process. Choosing an output port with lower latency can reduce data transmission time and improve performance.

[0048] Reliability: The reliability of the output port is also an important consideration. Choosing a more reliable output port can reduce the error rate and packet loss rate during data transmission.

[0049] Load balancing: If there are multiple output ports to choose from, you can consider load balancing the data traffic to distribute the data traffic evenly to different output ports, thereby improving overall performance and stability.

[0050] Functional requirements: Based on the specific application scenarios and needs, select the functions and protocols that the outgoing ports need to support to ensure that they can meet the actual requirements.

[0051] Taking all the above factors into account, the performance of multiple output ports can be comprehensively evaluated, and the most suitable output port can be selected as the first target output port of the routing device.

[0052] In an exemplary embodiment, before adding the first device identifier of the first routing device and the port identifier of the first target outgoing port to the first packet of the first data packet to obtain the second data packet, when multiple first outgoing ports are found from the first forwarding table entry of the first routing device, the method further includes: when only one first outgoing port is found from the first forwarding table entry, transmitting the first data packet to the second routing device through the first outgoing port. In this embodiment, if there is only one outgoing port, the first data packet is directly forwarded to the next-hop route through the only outgoing port. It is not necessary to set the device identifier and port identifier of the first routing device in the first packet. For example, as Figure 3 As shown, when the first routing device is SW2, after SW2 receives the first data packet, it first identifies that the first data packet carries an AR tag, enters the AR judgment process, queries the local forwarding table entries, obtains the corresponding next hop and outgoing port information, and finds that there is only one outgoing port that meets the conditions, port2-6. Therefore, it does not update the content of the first data packet and directly sends the first data packet to SW6. This allows for fast forwarding of data packets.

[0053] In an exemplary embodiment, before adding the first device identifier of the first routing device and the port identifier of the first target outgoing port to the first packet of the first data packet to obtain the second data packet, when multiple first outgoing ports are found from the first forwarding table entry of the first routing device, the method further includes: when multiple first outgoing ports are found from the first forwarding table entry, determining a first target outgoing port from the multiple first outgoing ports, and determining a second routing device corresponding to the first target outgoing port; determining a first layer label of the first routing device and a second layer label of the second routing device, wherein the first layer label is used to indicate the network layer where the first routing device is located, and the second layer label is used to indicate the network layer where the second routing device is located; when the first layer label is less than the second layer label, adding the first device identifier and the port identifier of the first target outgoing port to the first packet to obtain the second data packet; when the first layer label is greater than the second layer label, transmitting the first data packet to the second routing device through the first target outgoing port.

[0054] In one exemplary embodiment, determining the first target output port from a plurality of first output ports is the same as in the above embodiments, and will not be repeated here. The network layer where the routing device resides is bound to the network topology. For example, as Figure 4 As shown, SW7, SW8, SW9, and SW10 are at the first network layer level 10; SW3, SW4, SW5, and SW6 are at the second network layer level 11; and SW1 and SW2 are at the third network layer level 12. By comparing the layer labels of the routing devices, the layer in which the routing devices are located can be quickly determined, thereby enabling the rapid identification of routing devices that can perform path switching.

[0055] In an exemplary embodiment, comparing the first-layer label of the first routing device with the second-layer label of the second routing device is primarily aimed at determining the network layer to which the next-hop routing device belongs, thereby determining the method for forwarding data packets. For example, ... Figure 4As shown, SW7 itself belongs to level 1 0, meaning the level 1 ID of the next routing device will definitely not be less than 0. Therefore, SW7 can skip checking the level of the next hop and directly write its own device identifier, outgoing port identifier, and level 1 ID (i.e., 0) into the packet, then forward the packet to SW4. After receiving the packet, SW4 identifies the packet's AR identifier and first determines the forwarding direction. Its own level 1 is 1, so it queries the forwarding table. The next hop SW1's level 2 indicates that the packet is being forwarded upwards and also has AR capability. Therefore, SW4 fills the packet with the switch identifier corresponding to SW4, its level 1 ID (i.e., 1), and the outgoing port ID (port4-2) of the packet forwarded by this device, and forwards the packet to SW2. At this point, the packet carries information from both SW7 and SW4. After receiving the packet, SW2 identifies the packet's AR identifier. Since SW2 is forwarding the packet to a lower level, it no longer checks whether the packet itself has AR capability and directly forwards the packet to SW6. In addition, after SW6 recognizes the AR identifier and determines that the message is forwarded to Level 1, it can delete the SW4 information that also belongs to Level 1 in the original message, and only retain the Level 0 information.

[0056] In an exemplary embodiment, before adding the first device identifier of the first routing device and the port identifier of the first target outgoing port to the first packet of the first data packet to obtain the second data packet, when multiple first outgoing ports are found from the first forwarding table entry of the first routing device, the method further includes: querying the first forwarding table entry when the first packet includes first identification information, wherein the first identification information is used to identify the original data packet in the first data packet as a data packet that requires adaptive routing.

[0057] In an exemplary embodiment, after transmitting the second data packet to the second routing device via the first destination output port, the method further includes: receiving a first event message sent by the second routing device, wherein the first event message includes a first device identifier, a port identifier of the first destination output port, a packet identifier of the second data packet, and a first event, the first event indicating that congestion or failure has occurred on the path through which the second routing device transmits the second data packet to the third routing device, the third routing device being the next-hop routing device after the second routing device; and switching the transmission path of the second data packet based on the first event message.

[0058] In an exemplary embodiment, if congestion or a fault occurs on the path from the second routing device to the third routing device for transmitting a second data packet, the device will search for second data packets that exceed the congestion threshold. Based on the packet information in the second data packet, it will extract the identifier of the upstream device with AR capability for that second data packet and the port identifier information of the outgoing port that forwards the second data packet. A first event message will be generated. The destination address in the first event message is the address of the upstream device with AR capability for that second data packet, the source address is the address of the second routing device, and the first event message also carries the 5-tuple information of the second data packet and the port identifier information of the outgoing port. Upon receiving the first event message, since the destination address is itself, the first routing device will further process it, identifying the first event message as an ARN message with an AR event type of congestion. It will parse the flow identifier and outgoing port information in the first event message, confirming that the outgoing port exists in its local forwarding table entry for that first event message. Then, it will set that outgoing port to unavailable in the forwarding table and switch the packet to another available outgoing port, completing the routing switch. For example, as... Figure 4 As shown, when the first routing device is SW4 and the second routing device is SW6, SW6 detects congestion on the link SW6-SW10, reverses the lookup of the message information that triggered the congestion threshold exceeding, and extracts the identifier of the upstream device with AR capability for that message and the outgoing port identifier information of the device forwarding the message, which are the SW4 address and port4-7 ID, respectively. SW6 generates an ARN notification message with the destination IP being the SW4 address and the source IP being the SW6 address. The message also carries the message's five-tuple information and outgoing port identifier information. After receiving the first event message, SW4, since the destination IP is itself, further processes it, identifies the first event message as an ARN message, and the AR event type as congestion. It parses the flow identifier and outgoing port information in the message, confirms that the local forwarding table entry for the data packet corresponding to the first event message exists for that outgoing port, and then switches the data packet to port4-1 for transmission, thus completing the routing switch.

[0059] In addition, after sending the ARN message, SW6 will save the ARN message locally. The ARN message contains the five-tuple information of the second data packet, the upstream device identifier, the upstream device output port identifier, and the local congestion port information that triggered the ARN, as shown in Table 1.

[0060] Table 1:

[0061]

[0062] This embodiment can quickly find a routing device that can perform path switching by receiving a first event message sent by a second routing device and switching the transmission path of the second data packet based on the first event message.

[0063] In one exemplary embodiment, switching the transmission path of a second data packet based on a first event message includes: disabling the first target outgoing port when the port identifier of the first target outgoing port is found in a first forwarding table entry based on the first event message; determining a second target outgoing port from a plurality of first outgoing ports, wherein the second target outgoing port is a port other than the first target outgoing port among the plurality of first outgoing ports; and transmitting the second data packet to a fourth routing device through the second target outgoing port to switch the transmission path of the second data packet, wherein the fourth routing device is the next-hop routing device after the first routing device. In this embodiment, since the next-hop routing device of the second routing device corresponding to the first target outgoing port is congested, the first target outgoing port is an unavailable port, and it needs to be set to unavailable in the forwarding table entry to prevent subsequent packets from continuing to use it for transmission and causing congestion. For example, as Figure 4 As shown, after SW4 receives the first event message, since the destination IP is itself, it further processes it, identifies the first event message as an ARN message, the AR event type is congestion, parses the flow identifier and outgoing port information in the packet, confirms that the outgoing port exists in the local forwarding table entry for the data packet corresponding to the first event message, and then sets the outgoing port as unavailable in the forwarding table.

[0064] In an exemplary embodiment, after transmitting the second data packet to the fourth routing device through the second target outgoing port to switch the transmission path of the second data packet, the method further includes: receiving a first event cancellation message sent by the second routing device, wherein the first event cancellation message is a message generated by the second routing device based on a stored first event message, the first event cancellation message includes a first device identifier, a port identifier of the first target outgoing port, packet identifier information of the second data packet, and a first cancellation event, the first cancellation event being used to indicate that congestion or fault between the second routing device and the third routing device has been cleared; if the port identifier of the first target outgoing port is found in the first forwarding table entry based on the first event cancellation message, the disabling of the first target outgoing port is lifted.

[0065] In one exemplary embodiment, the second routing device can eliminate congestion in the following manner:

[0066] Flow control: Flow control can be used to limit the rate of data transmission to avoid network congestion. This can be achieved by setting bandwidth limits, priority queues, etc.

[0067] Congestion control: Congestion control algorithms can be used to detect network congestion and take corresponding measures, such as reducing the transmission rate and retransmitting lost data packets.

[0068] Load balancing: Traffic can be distributed to different paths or links through load balancing to avoid congestion on a particular path or link.

[0069] Caching mechanism: Caching mechanisms can be used to temporarily store data packets to reduce the impact of network congestion on transmission rate.

[0070] Using QoS (Quality of Service) technology: QoS technology can help routing devices classify and prioritize different types of traffic to ensure the transmission quality of important data while avoiding network congestion.

[0071] By combining the above methods, the second routing device can effectively eliminate network congestion and improve network performance and stability.

[0072] After the second routing device clears the congestion, if it finds a record of an ARN message sent in its local storage, it generates a first event clearance message. The first event clearance message is a congestion clearance notification message, carrying the five-tuple of the packet retrieved from the local record, the outgoing port identifier, and setting the destination address to the address in the record. After the first event clearance message is sent, the second routing device deletes the congestion record. Upon receiving the first event clearance message, the first routing device, since the destination address in the message is itself, further processes it, identifying the message as an ARN message with an AR event type of congestion clearance. It parses the flow identifier and outgoing port identifier, confirming that the current state of the outgoing port in its local forwarding table entry is unavailable for this message, and then sets the port in the forwarding table entry back to available, allowing subsequent traffic to continue forwarding from that port. For example, if... Figure 4As shown, after SW6 detects the congestion clearing on port 6-10, it queries the local associated ARN transmission record using the port 6-10 ID, generating an ARN message. The ARN message type indicates that this message is a congestion clearing notification message, and it also carries a five-tuple retrieved from the local record, the outgoing port port 6-10 identifier information, and sets the destination IP to the SW4 address. After this ARN message is sent, SW6 deletes the above record. Upon receiving the packet, SW4, since the destination IP is itself, further processes it, identifying the packet as an ARN message with an AR event type of congestion clearing. It parses the flow identifier and outgoing port information in the packet, confirming that port 4-2 in the local forwarding table entry is currently unavailable for this packet, and then sets the port in the forwarding table entry to available again, allowing subsequent traffic to continue to be forwarded from this port.

[0073] This embodiment can promptly unblock disabled outgoing ports by sending congestion relief messages to the routing devices along the forwarding path, thereby facilitating subsequent packet transmission.

[0074] In an exemplary embodiment, after transmitting the second data packet to the second routing device via the first destination output port, the method further includes: generating a second event message in the event of congestion or failure on the path through which the second data packet is transmitted to the second routing device via the first output port, wherein the second event message includes an identifier of another device of another routing device, a port identifier of another first destination output port, a packet identifier of the first data packet, and a second event, wherein the other routing device is an upstream routing device transmitting the first data packet, the other routing device includes a plurality of other ports that are allowed to transmit the first data packet, the other first destination output port is determined from the plurality of other ports, the port identifier of the other first destination output port is an identifier of the other first destination output port, and the second event is used to indicate that congestion or failure has occurred on the path through which the first routing device transmits the second data packet to the second routing device; and sending the second event message to the other routing device, wherein the other routing device is used to switch the transmission path of the first data packet based on the second event message.

[0075] In an exemplary embodiment, if congestion or a fault occurs on the path from the first routing device to the second routing device for transmitting a first data packet, the first routing device will search for the first data packet whose congestion threshold has been exceeded, or the first data packet originally intended to be forwarded from the faulty port / link. Based on the packet information in the first data packet, it will extract the identifier of the upstream device with AR capability for the first data packet and the port identifier information of the outgoing port from which the device forwarded the first data packet. A second event message will then be generated. The destination address in the second event message is the address of the upstream device with AR capability for the first data packet, the source address is the address of the first routing device, and the second event message also carries the 5-tuple information of the first data packet and the port identifier information of the outgoing port. Upon receiving the second event message, other routing devices, since the destination address is themselves, will further process it. They will identify the second event message as an ARN message, with the AR event type being congestion. They will parse the flow identifier and outgoing port information in the second event message, confirm that the outgoing port exists in their local forwarding table for the second event message, then mark the outgoing port as unavailable in the forwarding table, and simultaneously switch the packet to another available outgoing port, completing the routing switch.

[0076] In an exemplary embodiment, before sending the second event message to the other routing devices, the method further includes: determining a first-level label of the first routing device and a second-level label of the second routing device, wherein the first-level label represents the network layer where the first routing device is located, and the second-level label represents the network layer where the second routing device is located; if the first-level label is less than the second-level label, determining the upstream routing device closest to the first routing device and capable of route switching as the other routing device, and setting the layer label of the other routing device in the second event message; if the first-level label is greater than the second-level label, determining the upstream routing device at the same layer as the first routing device and capable of route switching as the other routing device, and setting the layer label of the other routing device in the second event message. In this embodiment, by comparing the layer labels of the routing devices, the layer where the routing device is located can be quickly determined, thereby quickly finding the routing device capable of path switching.

[0077] Furthermore, this embodiment can also control the sending of ARN notification messages based on ARN message sending records. For example, for messages with the same packet identifier and originating from the same AR device port, adaptive routing notifications do not need to be sent repeatedly. Therefore, before generating an ARN notification message, it is necessary to query whether there is already a sending record with the same content locally, based on the packet identifier, target AR device, and outgoing port information. If so, it will not be sent again. However, considering the possibility of packet loss after the ARN notification message is sent, if packet loss occurs, routing cannot be completed, and congestion will continue. Therefore, a decision can also be made based on the frequency of requests or events that generate the same ARN content. If the frequency remains high after the ARN notification message sending record is generated, an ARN notification message with the same content can be sent again for the same record. After congestion occurs at the outgoing port, it may affect the forwarding of packets in multiple flows. In most cases, it is not necessary to switch the path of all packets originating from that port; switching some packets can eliminate congestion. Therefore, upon detecting congestion, the generation and transmission of ARN messages can be controlled immediately to prevent excessive ARN message generation and propagation in the network, excessive message switching, and the resulting load imbalance. Thus, after sending ARN notifications to a portion of traffic, a waiting period can be established. If the congestion clears, no more ARN notification messages are generated; if congestion persists, ARN notification messages are generated and sent to the remaining traffic. This can be achieved by adding timestamps or other markers to existing ARN notification message transmission records.

[0078] In one exemplary embodiment, after sending the second event message to other routing devices, the method further includes: if it is determined that the congestion or fault between the first routing device and the second routing device has been cleared, generating a second event cancellation message based on the stored second event message, wherein the second event cancellation message includes an identifier of another device, a port identifier of another first target outgoing port, a message identifier of a first data packet, and a second cancellation event, the second cancellation event being used to indicate that the congestion or fault between the first routing device and the second routing device has been cleared; and sending the second event cancellation message to other routing devices, wherein the other routing devices are used to unblock the other first target outgoing port based on the second event cancellation message.

[0079] In one exemplary embodiment, the first routing device eliminates congestion in the same way as the second routing device, and will not be described again here.

[0080] After the first routing device clears the congestion, it generates a second event clearance message upon finding a record of an ARN message sent in its local storage. This second event clearance message is a congestion clearance notification message, carrying the packet's five-tuple retrieved from the local record, the outgoing port identifier, and setting the destination address to the address in the record. After the second event clearance message is sent, other routing devices delete the congestion records. Upon receiving the first event clearance message, other routing devices, seeing that the destination address in the second event clearance message is themselves, further process it. They identify the second event clearance message as an ARN message with an AR event type of congestion clearance, parse the flow identifier and outgoing port identifier in the second event clearance message, confirm that the current state of the outgoing port in their local forwarding table entry is unavailable for this second event clearance message, and then re-set the port in the forwarding table entry to available, allowing subsequent traffic to continue forwarding from that port. This embodiment, by sending the congestion clearance message to the routing devices along the forwarding path, can promptly unblock disabled outgoing ports, thus facilitating subsequent packet transmission.

[0081] In one exemplary embodiment, after sending the second event message to other routing devices, the method further includes: during the process of transmitting other data packets to the second routing device through the first output port, continuing to generate other event messages, sending the other event messages to other routing devices, and storing the other event messages, wherein the other event messages are messages of the same type as the second event message; after sending N other event messages to other routing devices, or after sending a preset number of other event messages to other routing devices, stopping the generation of other event messages, where N is a natural number greater than 1.

[0082] In one exemplary embodiment, after stopping the generation of other event messages, the method further includes one of the following: if it is determined after a preset time period that the congestion between the first routing device and the second routing device has not been eliminated, continuing to generate other event messages; or if it is determined after a preset time period that the congestion between the first routing device and the second routing device has been eliminated, stopping the generation of other event messages.

[0083] The primary objective of this embodiment is to suppress the transmission of event messages. That is, after the second event message is sent, the first routing device continues to send data packets to the second routing device, and the first routing device continues to generate other event messages until the number of other event messages sent equals N (the value of N can be arbitrarily set, for example, 50), or the proportion of other event messages sent equals a preset number (for example, the setting is to send a maximum of 100 event messages, and 50% of the event messages have already been sent). At this point, the transmission of event messages can be paused. After a preset pause period (for example, 1 minute), it is determined whether the congestion has been eliminated. If it has been eliminated, transmission stops. If it has not been eliminated, transmission continues. This saves resources used for sending event messages.

[0084] The present application will now be described in conjunction with specific embodiments:

[0085] like Figure 4 As shown, this specific embodiment takes the transmission of data packets in a three-layer FT network as an example for illustration: Each switch in the network has numbered its local ports. The port connected to SW7 and SW4 is port 7-4, the port connected to SW4 and SW2 is port 4-2, and so on. Each switch is configured with a loopback address (switch address), and this address can be used for routing.

[0086] For example, a data flow originates from SW7 and travels to SW10. The ingress switch SW7 identifies this data flow as an "elephant flow" and marks all its sub-flows with an AR (Adaptive Routing) tag, indicating the need for adaptive routing. During a certain time period, the path of this data flow is SW7-SW4-SW2-SW6-SW10, and the forwarding process is as follows:

[0087] S11, during the data flow forwarding process, SW7 queries its local forwarding table to obtain the corresponding next-hop routing device and outgoing port information. For this data flow, in addition to port 7-4, which is directly connected to SW4, SW7 also has another uncongested available port 7-3, meaning SW7 has AR capability for this packet. Therefore, SW7 fills the data flow with SW7's switch identifier and the ID of the outgoing port 7-4 that the data flow is forwarding on this device, and forwards the data flow to SW4.

[0088] After receiving the data stream (S12), SW4 first identifies that the data stream carries an AR tag. Therefore, it queries the local forwarding table to obtain the corresponding next-hop routing device and outgoing port information. For this data stream, in addition to the port 4-2 directly connected to SW2, SW4 has another uncongested available port, meaning it has AR capability for this data stream. SW4 then replaces the switch identifier and outgoing port identifier information in the data stream with SW4's switch address and the outgoing port ID (port 4-7ID) that the data stream is forwarded on this device, and forwards the data stream to SW2.

[0089] After receiving the message, S13 and SW2 first identify that the data stream carries the AR tag, enter the AR judgment process, query the local forwarding table entries, obtain the corresponding next-hop routing device and outgoing port information, and find that there is only one outgoing port 2-6 that meets the conditions. Therefore, the data stream content is not updated, and the data stream is directly sent to SW6.

[0090] S14, on SW6, congestion is detected on link SW6-SW10. The data flow information triggering the congestion threshold exceeding is retrieved, and the upstream device identifier with AR capability for this packet and the outgoing port identifier for forwarding this data flow are extracted from the data flow information. These are the SW4 address and port4-7 ID, respectively. SW6 generates an ARN notification message with the destination IP being the SW4 address and the source IP being the SW6 address. The data flow also carries the data flow's five-tuple information and the outgoing port identifier.

[0091] After receiving the data stream, S15 and SW4 further process it since the destination IP is itself. They identify the data stream as an ARN message with an AR event type of congestion, parse the flow identifier and outgoing port information in the data stream, confirm that the outgoing port exists in the local forwarding table for this data stream, set the outgoing port to unavailable in the forwarding table, and switch the data stream to port4-1 to complete the routing.

[0092] In another specific embodiment, for a certain period of time, the data stream packets are forwarded along the path SW7-SW4-SW2-SW6-SW10, and the specific process is as follows:

[0093] S21, SW7 needs to use adaptive routing to identify traffic and mark it. SW7 queries its local forwarding table to obtain the corresponding next-hop routing device and outgoing port information. For this data flow, SW7 has another uncongested available port besides the port directly connected to SW4, i.e., it has AR capability. In addition, SW7 itself belongs to level 1 0, meaning the level ID of the next device will definitely not be less than 0. Therefore, SW7 can directly write its own device identifier, outgoing port identifier, and level ID (i.e., 0) into the data flow without checking the level of the next hop, and forward the data flow to SW4.

[0094] S22, after receiving the data stream, SW4 identifies the AR (Augmented Response) identifier of the data stream and first determines the forwarding direction. Its own Level I is 1, and it queries the forwarding table. The Level I of the next hop SW1 is 2, therefore it determines that the data stream is being forwarded upwards and that it also has AR capability for this data stream. Therefore, SW4 fills the data stream with the switch identifier corresponding to SW4, its Level I ID (i.e., 1), and the port 4-2 ID of the outgoing port forwarded by this device, and forwards the data stream to SW2. At this time, the data stream simultaneously carries information about SW7 and SW4.

[0095] S23, after receiving the data stream, SW2 identifies the AR identifier of the data stream. Since SW2 forwards the data stream to a lower level, it no longer determines whether the packet itself has AR capability and directly forwards the data stream to SW6.

[0096] S24, after SW6 identifies the AR identifier of the data stream and determines that the packet is forwarded down to Level 1, it can delete the SW4 information belonging to Level 1 in the original data stream, retaining only the Level 10 information. If congestion occurs between SW6 and SW10, SW6 queries the data stream causing the congestion, extracts the upstream AR device information from it, and since the congestion occurred from SW6 down to SW10 at Level 10, it extracts the AR device information belonging to Level 10, as well as the SW7 address and port 7-4 identifier information from the original data stream, generates an ARN data stream, and sends it to SW7.

[0097] In one exemplary embodiment, the process of sending, receiving, and processing ARN messages after the AR event is eliminated includes:

[0098] After sending an ARN message, SW6 stores the ARN record locally. This record includes the packet's five-tuple information, the upstream device identifier, the upstream device's outgoing port identifier, and the local congestion port information that triggered the ARN. Once SW6 detects congestion relief on port 6-10, it queries the local ARN transmission record associated with that port using the port 6-10 ID. An ARN message is then generated. This message type indicates that it is a congestion relief notification message, and it carries the five-tuple retrieved from the local record, the outgoing port identifier (port 6-10), and sets the destination IP to the SW4 address. After sending this ARN message, SW6 deletes the above record.

[0099] After receiving the message, S32 and SW4 further process it since the destination IP is themselves. They identify the message as an ARN message with an AR event type of congestion relief. They parse the flow identifier and outgoing port information in the data stream and confirm that port4-2 in the local forwarding table is currently unavailable for this data stream. Then they reset the port in the forwarding table to be available, and subsequent traffic can continue to be forwarded from this port.

[0100] This specific embodiment marks the data stream, allowing routing devices along the route to identify whether adaptive routing processing is needed based on the markings. When a routing device receives a data stream and determines that multiple available outgoing ports exist, it writes the outgoing port identifier into the data stream, in addition to its own device identifier. This allows it to locate the routing device using the device identifier carried in the ARN message during congestion or faults, and to determine the affected forwarding table entries using the packet identifier and outgoing port identifier. Furthermore, it uses local ARN records after sending the ARN message to suppress ARN messages, and quickly generates notification messages based on the recorded messages after the ARN event is cleared, sending them to the corresponding routing devices. This improves data stream forwarding efficiency and saves network resources.

[0101] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0102] This embodiment also provides a data packet transmission device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0103] Figure 5 This is a structural block diagram of a data packet transmission apparatus according to embodiments of this application, such as... Figure 5 As shown, the device includes:

[0104] The first receiving module 52 is used to receive the first data packet;

[0105] The first adding module 54 is used to add the first device identifier of the first routing device and the port identifier of the first target outgoing port to the first packet of the first data packet when multiple first outgoing ports are found in the first forwarding table entry of the first routing device, so as to obtain a second data packet. The multiple first outgoing ports are ports that are allowed to forward the first data packet, and the first target outgoing port is the packet forwarding port selected from the multiple first outgoing ports.

[0106] The first transmission module 56 is used to transmit the second data packet to the second routing device through the first target output port.

[0107] In one exemplary embodiment, the above-described apparatus further includes one of the following: a first setting module, configured to, when multiple first outgoing ports are found from the first forwarding table entry of the first routing device, add the first device identifier of the first routing device and the port identifier of the first target outgoing port of the first target outgoing port to the first packet of the first data packet to obtain the second data packet, and, if the data volume of the original data packet in the first data packet is greater than a first preset data volume, set first identification information in the first packet, wherein the first identification information is used to identify the first data packet as a data packet requiring adaptive routing, and adaptive routing is used to indicate that when the current forwarding path does not meet the forwarding requirements of the first data packet... The first data packet has the function of switching the first data packet to another path that meets the forwarding conditions for forwarding; the second setting module is used to add the first device identifier of the first routing device and the port identifier of the first target outgoing port of the first target outgoing port to the first packet of the first data packet when multiple first outgoing ports are found from the first forwarding table entry of the first routing device. Before obtaining the second data packet, if the data volume of the original data packet in the first data packet is less than the second preset data volume, or if the type of the original data packet in the first data packet is a preset type, the second identification information is set in the first packet, wherein the second identification information is used to identify the original data packet as a data packet that does not require adaptive routing.

[0108] In an exemplary embodiment, the first adding module 54 includes: a first adding unit, configured to add a first device identifier and a port identifier of a first target outgoing port to a first packet when multiple first outgoing ports are found from a first forwarding table entry, to obtain a second data packet; or, when multiple first outgoing ports are found from a first forwarding table entry, and the first packet also includes other device identifiers and port identifiers of other first target outgoing ports, add the first device identifier and the port identifier of the first target outgoing port to the first packet to replace the other device identifiers and port identifiers of other first target outgoing ports, to obtain a second data packet, wherein the other device identifier is the identifier of another routing device that transmits the first data packet through other first target outgoing ports before the first routing device, and the other routing device includes multiple other ports that are allowed to transmit the first data packet, the other first target outgoing ports are determined from multiple other ports, and the port identifier of the other first target outgoing ports is the identifier of the other first target outgoing ports.

[0109] In one exemplary embodiment, the apparatus further includes: a first transmission unit, configured to, when multiple first outgoing ports are found in the first forwarding table entry of the first routing device, add the first device identifier of the first routing device and the port identifier of the first target outgoing port to the first message of the first data packet to obtain the second data packet, and when only one first outgoing port is found in the first forwarding table entry, transmit the first data packet to the second routing device through the first outgoing port.

[0110] In an exemplary embodiment, the apparatus further includes: a first determining module, configured to, when multiple first outgoing ports are found in the first forwarding table entry of the first routing device, add a first device identifier of the first routing device and a port identifier of the first target outgoing port to a first packet of the first data packet to obtain a second data packet; and, when multiple first outgoing ports are found in the first forwarding table entry, determine a first target outgoing port from the multiple first outgoing ports and determine a second routing device corresponding to the first target outgoing port; a second determining module, configured to determine a first layer label of the first routing device and a second layer label of the second routing device, wherein the first layer label is used to represent the network layer where the first routing device is located, and the second layer label is used to represent the network layer where the second routing device is located; a second adding module, configured to, when the first layer label is less than the second layer label, add the first device identifier and the port identifier of the first target outgoing port to the first packet to obtain a second data packet; and a second transmitting module, configured to, when the first layer label is greater than the second layer label, transmit the first data packet to the second routing device through the first target outgoing port.

[0111] In one exemplary embodiment, the above apparatus further includes: a query module, configured to, when multiple first outgoing ports are found in the first forwarding table entry of the first routing device, add the first device identifier of the first routing device and the port identifier of the first target outgoing port to the first packet of the first data packet to obtain the second data packet, query the first forwarding table entry if the first packet includes first identification information, wherein the first identification information is used to identify the original data packet in the first data packet as a data packet requiring adaptive routing.

[0112] In one exemplary embodiment, the apparatus further includes: a second receiving module, configured to receive a first event message sent by the second routing device after transmitting the second data packet to the second routing device through the first target output port, wherein the first event message includes a first device identifier, a port identifier of the first target output port, a packet identifier of the second data packet, and a first event, the first event indicating that congestion or failure has occurred on the path through which the second routing device transmits the second data packet to the third routing device, the third routing device being the next-hop routing device after the second routing device; and a first switching module, configured to switch the transmission path of the second data packet based on the first event message.

[0113] In one exemplary embodiment, the first switching module includes: a first setting unit, configured to disable the first target outgoing port when the port identifier of the first target outgoing port is found in the first forwarding table entry based on a first event message; a first determining unit, configured to determine a second target outgoing port from a plurality of first outgoing ports, wherein the second target outgoing port is a port other than the first target outgoing port among the plurality of first outgoing ports; and a second transmission unit, configured to transmit a second data packet to a fourth routing device through the second target outgoing port to switch the transmission path of the second data packet, wherein the fourth routing device is the next-hop routing device after the first routing device.

[0114] In one exemplary embodiment, the apparatus further includes: a third receiving module, configured to receive a first event cancellation message sent by the second routing device after transmitting the second data packet to the fourth routing device through the second target output port to switch the transmission path of the second data packet, wherein the first event cancellation message is a message generated by the second routing device based on a stored first event message, and the first event cancellation message includes a first device identifier, a port identifier of the first target output port, packet identifier information of the second data packet, and a first cancellation event, the first cancellation event being used to indicate that congestion or fault between the second routing device and the third routing device has been cleared; and a first release module, configured to release the disabling of the first target output port if the port identifier of the first target output port is found in the first forwarding table entry based on the first event cancellation message.

[0115] In one exemplary embodiment, the apparatus further includes: a first generation module, configured to generate a second event message after transmitting a second data packet to a second routing device via a first target output port, in the event of congestion or failure on the path through which the second data packet is transmitted to the second routing device via the first output port, wherein the second event message includes an identifier of another device of another routing device, a port identifier of another first target output port, a packet identifier of the first data packet, and a second event, wherein the other routing device is an upstream routing device transmitting the first data packet, the other routing device includes a plurality of other ports that are allowed to transmit the first data packet, the other first target output port is determined from the plurality of other ports, the port identifier of the other first target output port is an identifier of the other first target output port, and the second event is used to indicate that congestion or failure has occurred on the path through which the first routing device transmits the second data packet to the second routing device; and a first sending module, configured to send the second event message to the other routing device, wherein the other routing device is used to switch the transmission path of the first data packet based on the second event message.

[0116] In an exemplary embodiment, the apparatus further includes: a third determining module, configured to determine a first-level label of the first routing device and a second-level label of the second routing device before sending the second event message to the other routing device, wherein the first-level label is used to represent the network layer where the first routing device is located, and the second-level label is used to represent the network layer where the second routing device is located; a fourth determining module, configured to determine the upstream routing device closest to the first routing device and capable of routing switching as the other routing device when the first-level label is less than the second-level label, and set the level label of the other routing device in the second event message; and a fifth determining module, configured to determine the upstream routing device at the same level as the first routing device and capable of routing switching as the other routing device when the first-level label is greater than the second-level label, and set the level label of the other routing device in the second event message.

[0117] In one exemplary embodiment, the apparatus further includes: a second generation module, configured to, after sending the second event message to other routing devices, generate a second event cancellation message based on the stored second event message, provided that congestion or fault between the first routing device and the second routing device has been cleared, wherein the second event cancellation message includes an identifier of another device, a port identifier of another first target output port, a message identifier of a first data packet, and a second cancellation event, the second cancellation event indicating that congestion or fault between the first routing device and the second routing device has been cleared; and a second sending module, configured to send the second event cancellation message to other routing devices, wherein the other routing devices are configured to unblock other first target output ports based on the second event cancellation message.

[0118] In one exemplary embodiment, the above apparatus further includes: a first processing module, configured to, after sending the second event message to other routing devices, continue to generate other event messages, send the other event messages to other routing devices, and store the other event messages during the process of transmitting other data packets to the second routing devices through the first output port, wherein the other event messages are messages of the same type as the second event message; and a second processing module, configured to, after sending N other event messages to other routing devices, or after sending a preset number of other event messages to other routing devices, stop generating other event messages, where N is a natural number greater than 1.

[0119] In one exemplary embodiment, the above apparatus further includes one of the following: a third processing module, configured to continue generating other event messages after stopping the generation of other event messages, and after determining that the congestion between the first routing device and the second routing device has not been eliminated after a preset time period; and a fourth processing module, configured to stop generating other event messages after determining that the congestion between the first routing device and the second routing device has been eliminated after a preset time period.

[0120] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0121] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.

[0122] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.

[0123] The embodiments described herein also provide a computer program that includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in any of the above method embodiments.

[0124] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.

[0125] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0126] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0127] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0128] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0129] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0130] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A method for transmitting data packets, characterized in that, include: Receive the first data packet; If multiple first outgoing ports are found in the first forwarding table entry of the first routing device, the first device identifier of the first routing device and the port identifier of the first target outgoing port are added to the first packet of the first data packet to obtain the second data packet. The multiple first outgoing ports are ports that are allowed to forward the first data packet, and the first target outgoing port is the packet forwarding port selected from the multiple first outgoing ports. The second data packet is transmitted to the second routing device through the first target output port.

2. The method according to claim 1, characterized in that, If multiple first outgoing ports are found in the first forwarding table entry of the first routing device, before adding the first device identifier of the first routing device and the port identifier of the first target outgoing port of the first target outgoing port to the first packet of the first data packet to obtain the second data packet, the method further includes one of the following: If the amount of data in the original data packet in the first data packet is greater than the first preset data amount, first identification information is set in the first packet. The first identification information is used to identify the first data packet as a data packet that requires adaptive routing. The adaptive routing is used to indicate the function of switching the first data packet to other paths that meet the forwarding conditions when the current forwarding path does not meet the forwarding requirements of the first data packet. If the amount of data in the original data packet in the first data packet is less than the second preset data amount, or if the type of the original data packet in the first data packet is a preset type, a second identification information is set in the first packet, wherein the second identification information is used to identify the original data packet as a data packet that does not require adaptive routing.

3. The method according to claim 1, characterized in that, If multiple first outgoing ports are found in the first forwarding table entry of the first routing device, the first device identifier of the first routing device and the port identifier of the first destination outgoing port are added to the first packet of the first data packet to obtain the second data packet, which includes: If multiple first outgoing ports are found from the first forwarding table entry, the first device identifier and the port identifier of the first target outgoing port are added to the first packet to obtain a second data packet; or, if multiple first outgoing ports are found from the first forwarding table entry, and the first packet also includes other device identifiers and port identifiers of other first target outgoing ports, the first device identifier and the port identifier of the first target outgoing port are added to the first packet to replace the other device identifier and the port identifier of the other first target outgoing port to obtain a second data packet, wherein the other device identifier is the identifier of another routing device that transmits the first data packet through another first target outgoing port before the first routing device, and the other routing device includes multiple other ports that are allowed to transmit the first data packet, the other first target outgoing port is determined from the multiple other ports, and the port identifier of the other first target outgoing port is the identifier of the other first target outgoing port.

4. The method according to claim 1, characterized in that, If multiple first outgoing ports are found in the first forwarding table entry of the first routing device, before adding the first device identifier of the first routing device and the port identifier of the first destination outgoing port to the first packet of the first data packet to obtain the second data packet, the method further includes: If only one first outgoing port is found in the first forwarding table entry, the first data packet is transmitted to the second routing device through the first outgoing port.

5. The method according to claim 1, characterized in that, If multiple first outgoing ports are found in the first forwarding table entry of the first routing device, before adding the first device identifier of the first routing device and the port identifier of the first destination outgoing port to the first packet of the first data packet to obtain the second data packet, the method further includes: If multiple first outgoing ports are found from the first forwarding table entry, the first target outgoing port is determined from the multiple first outgoing ports, and the second routing device corresponding to the first target outgoing port is determined; Determine the first layer label of the first routing device and the second layer label of the second routing device, wherein the first layer label is used to indicate the network layer in which the first routing device is located, and the second layer label is used to indicate the network layer in which the second routing device is located; If the first level label is less than the second level label, the first device identifier and the port identifier of the first target output port are added to the first message to obtain the second data message; If the first level label is greater than the second level label, the first data packet is transmitted to the second routing device through the first target output port.

6. The method according to any one of claims 3-5, characterized in that, If multiple first outgoing ports are found in the first forwarding table entry of the first routing device, before adding the first device identifier of the first routing device and the port identifier of the first destination outgoing port to the first packet of the first data packet to obtain the second data packet, the method further includes: If the first message includes first identification information, the first forwarding table entry is queried, wherein the first identification information is used to identify the original data message in the first data message as a data message that requires adaptive routing.

7. The method according to claim 1, characterized in that, After transmitting the second data packet to the second routing device through the first target output port, the method further includes: The system receives a first event message sent by the second routing device, wherein the first event message includes the first device identifier, the port identifier of the first target output port, the message identifier of the second data packet, and a first event. The first event indicates that there is congestion or failure on the path from which the second routing device transmits the second data packet to the third routing device, and the third routing device is the next-hop routing device after the second routing device. The transmission path of the second data packet is switched based on the first event message.

8. The method according to claim 7, characterized in that, Switching the transmission path of the second data packet based on the first event message includes: If the port identifier of the first target outgoing port is found in the first forwarding table entry based on the first event message, the first target outgoing port is set to disabled; A second target output port is determined from a plurality of first output ports, wherein the second target output port is a port other than the first target output port among the plurality of first output ports; The second data packet is transmitted to the fourth routing device through the second target output port to switch the transmission path of the second data packet, wherein the fourth routing device is the next-hop routing device after the first routing device.

9. The method according to claim 8, characterized in that, After transmitting the second data packet to the fourth routing device through the second target output port to switch the transmission path of the second data packet, the method further includes: The second routing device receives a first event cancellation message, wherein the first event cancellation message is a message generated by the second routing device based on the stored first event message. The first event cancellation message includes the first device identifier, the port identifier of the first target output port, the message identifier information of the second data packet, and a first cancellation event. The first cancellation event is used to indicate that the congestion or fault between the second routing device and the third routing device has been cleared. If the port identifier of the first target outgoing port is found in the first forwarding table entry based on the first event cancellation message, the disabling of the first target outgoing port is lifted.

10. The method according to claim 1, characterized in that, After transmitting the second data packet to the second routing device through the first target output port, the method further includes: If congestion or a fault occurs on the path through the first outgoing port to transmit the second data packet to the second routing device, a second event message is generated. The second event message includes the identifier of another device of another routing device, the port identifier of another first destination outgoing port, the packet identifier of the first data packet, and a second event. The other routing device is the upstream routing device that transmits the first data packet. The other routing device includes multiple other ports that are allowed to transmit the first data packet. The other first destination outgoing port is determined from the multiple other ports. The port identifier of the other first destination outgoing port is the identifier of the other first destination outgoing port. The second event is used to indicate that congestion or a fault has occurred on the path through which the first routing device transmits the second data packet to the second routing device. The second event message is sent to the other routing devices, wherein the other routing devices are used to switch the transmission path of the first data packet based on the second event message.

11. The method according to claim 10, characterized in that, Before sending the second event message to the other routing devices, the method further includes: Determine the first layer label of the first routing device and the second layer label of the second routing device, wherein the first layer label is used to indicate the network layer in which the first routing device is located, and the second layer label is used to indicate the network layer in which the second routing device is located; If the first hierarchical label is less than the second hierarchical label, the upstream routing device that is closest to the first routing device and has routing switching capability is identified as the other routing device, and the hierarchical label of the other routing device is set in the second event message; If the first level label is greater than the second level label, the upstream routing device that is at the same level as the first routing device and has routing switching capability is identified as the other routing device, and the level label of the other routing device is set in the second event message.

12. The method according to claim 10, characterized in that, After sending the second event message to the other routing devices, the method further includes: If it is determined that the congestion or fault between the first routing device and the second routing device has been cleared, a second event clearance message is generated based on the stored second event message. The second event clearance message includes the identifier of the other device, the port identifier of the other first target output port, the message identifier of the first data packet, and the second clearance event. The second clearance event is used to indicate that the congestion or fault between the first routing device and the second routing device has been cleared. The second event clearance message is sent to the other routing devices, wherein the other routing devices are used to unblock the other first target outgoing port based on the second event clearance message.

13. The method according to claim 10, characterized in that, After sending the second event message to the other routing devices, the method further includes: During the process of transmitting other data packets to the second routing device through the first output port, other event messages are generated, sent to the other routing device, and stored. The other event messages are of the same type as the second event messages. After sending N other event messages to the other routing devices, or after sending a preset number of other event messages to the other routing devices, the generation of other event messages is stopped, where N is a natural number greater than 1.

14. The method according to claim 13, characterized in that, After ceasing the generation of the other event messages, the method further includes one of the following: If, after a preset time period, it is determined that the congestion between the first routing device and the second routing device has not been cleared, the other event messages will continue to be generated. If, after a preset time period, it is determined that the congestion between the first routing device and the second routing device has been cleared, the generation of the other event messages will cease.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method described in any one of claims 1 to 14.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 14.

17. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 14.