ECMP-based message forwarding methods, apparatus, devices, and storage media
By receiving and processing ECMP routing flow tables in hardware, the problem of excessive resource consumption in ECMP routing by OVS is solved, achieving more efficient network performance and resource utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUHAI XINGYUN ZHILIAN TECH CO LTD
- Filing Date
- 2023-05-31
- Publication Date
- 2026-07-03
Smart Images

Figure CN116545921B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and more specifically, to a message forwarding method, apparatus, device, and storage medium based on ECMP. Background Technology
[0002] Equal Cost Multi Path (ECMP) technology refers to distributing traffic across multiple paths when multiple equivalent paths are available, thereby achieving load balancing and improving network performance. ECMP enables network traffic balancing and redundancy by simultaneously sending data packets to multiple identical next-hop routers. In ECMP, when multiple equivalent paths are available, routers can distribute data packets to one of these paths according to rules, thus achieving multi-path load balancing. For example, in a network topology where a destination host has two equivalent paths to choose from, the router can distribute data packets evenly across these paths according to its internal algorithm, achieving load balancing. ECMP technology is widely used in various network environments, including enterprise intranets, ISP networks, and cloud computing platforms. By using ECMP technology, network administrators can effectively manage network traffic and improve network bandwidth utilization.
[0003] Currently, cloud computing networks widely use SDN (Software Defined Networking) to manage networks, with OpenvSwitch (OVS) being a leading example. OVS also supports ECMP, but it implements ECMP through software. ECMP routing involves a series of software-intensive operations, including matching flow tables, calculating routing algorithms, and editing and forwarding traffic after routing. Under high traffic conditions, this can significantly impact OVS's core services. Therefore, how to avoid OVS consuming excessive resources when implementing ECMP is a problem that those skilled in the art need to solve. Summary of the Invention
[0004] The purpose of this invention is to provide a message forwarding method, apparatus, device, and storage medium based on ECMP, so as to avoid OVS consuming a large amount of resources when implementing ECMP.
[0005] To achieve the above objectives, this invention provides an ECMP-based packet forwarding method, which is applied in hardware, and the packet forwarding includes:
[0006] Receive raw messages;
[0007] Determine whether a target routing flow table exists that matches the original message;
[0008] If it exists, then the ECMP routing and forwarding action is directly executed using the target routing flow table;
[0009] If it does not exist, the original message is sent to the software so that the software performs ECMP routing forwarding on the original message and offloads the generated routing flow table to the hardware.
[0010] Preferably, determining whether a target routing flow table matching the original message exists includes:
[0011] Determine the target IP address of the original message;
[0012] Based on the target IP address, check if a matching first-level routing flow table exists;
[0013] If it exists, it is determined that a target routing flow table matching the original message exists; if it does not exist, it is determined that no target routing flow table matching the original message exists.
[0014] Preferably, the ECMP routing and forwarding action is directly executed using the target routing flow table, including:
[0015] Determine the number of routing members and their associated IDs from the first-level routing flow table;
[0016] Calculate the hash value using the five-tuple of the original message;
[0017] The hash value is moduloed based on the number of routing members to obtain the modulo value;
[0018] The matching second-level routing flow table is found using the associated ID and the modulo value, and the member exit information is determined based on the second-level routing flow table.
[0019] The original message is forwarded to the corresponding device using the member exit information.
[0020] Preferably, after determining the member exit information based on the second-level routing flow table, the method further includes:
[0021] Determine whether the original message needs to be edited based on the matching second-level routing flow table;
[0022] If so, the original message is edited, and the edited original message is forwarded to the corresponding device using the member exit information;
[0023] If not, the original message will be forwarded directly to the corresponding device using the member exit information.
[0024] Preferably, determining whether the original message needs to be edited includes:
[0025] Determine whether the source IP address and source MAC address of the original message need to be edited.
[0026] Preferably, the hardware is an ASIC chip and the software is a virtual switch.
[0027] Preferably, after sending the original message to the software, the process includes:
[0028] Receive the routing flow table sent by the software through the offload interface.
[0029] To achieve the above objectives, the present invention further provides an ECMP-based packet forwarding device, wherein the packet forwarding device is applied in hardware and includes:
[0030] The message receiving module is used to receive raw messages;
[0031] The judgment module is used to determine whether a target routing flow table matching the original message exists;
[0032] The forwarding module is used to directly execute ECMP routing and forwarding actions using the target routing flow table when a target routing flow table that matches the original packet exists.
[0033] The sending module is used to send the original packet to the software when there is no target routing flow table that matches the original packet, so that the software can perform ECMP routing forwarding on the original packet and offload the generated routing flow table to the hardware.
[0034] To achieve the above objectives, the present invention further provides an electronic device, comprising:
[0035] Memory, used to store computer programs;
[0036] A processor is configured to implement the steps of the ECMP-based packet forwarding method described in any of the above method embodiments when executing the computer program.
[0037] To achieve the above objectives, the present invention further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the ECMP-based packet forwarding method described in any of the above method embodiments.
[0038] As can be seen from the above solutions, the present invention provides an ECMP-based packet forwarding method, apparatus, device, and storage medium. In this method, the packet forwarding is mainly implemented in hardware. After receiving the original packet, the hardware needs to determine whether a target routing flow table matching the original packet exists. If it does, the ECMP routing forwarding action is directly performed using the target routing flow table. If it does not exist, the original packet is sent to the software so that the software can perform ECMP routing forwarding on the original packet and offload the generated routing flow table to the hardware. Therefore, this solution, after performing ECMP routing forwarding on the original packet using software, needs to offload the generated routing flow table to the hardware. Subsequently, when the hardware receives a packet matching the routing flow table, it can directly perform ECMP routing forwarding actions through the hardware, avoiding the resource consumption associated with implementing ECMP through software. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a flowchart of the ECMP routing process in the traditional solution.
[0041] Figure 2 This is a schematic diagram of a message forwarding method based on ECMP disclosed in an embodiment of the present invention;
[0042] Figure 3 This is an overall flowchart of ECMP routing disclosed in an embodiment of the present invention;
[0043] Figure 4 This is a schematic diagram of another ECMP-based message forwarding method disclosed in an embodiment of the present invention;
[0044] Figure 5 This is a schematic diagram of the main ECMP route selection and offloading process disclosed in an embodiment of the present invention;
[0045] Figure 6 This is an overall flowchart of the hardware execution of ECMP routing and forwarding actions disclosed in an embodiment of the present invention;
[0046] Figure 7 This is a schematic diagram of a message forwarding device based on ECMP disclosed in an embodiment of the present invention;
[0047] Figure 8 This is a schematic diagram of an electronic device structure disclosed in an embodiment of the present invention. Detailed Implementation
[0048] In traditional solutions, ECMP routing functionality is performed using software. (See [link to relevant documentation]). Figure 1 This is a flowchart of the ECMP routing process in a traditional solution. In the diagram, DPU (Data Processing Unit) is the data processor, eth is the Ethernet interface, OVS (Open vSwitch) is the virtual switch, DPDK (Data Plane Development Kit) is the data plane development kit, eth-rep is the Ethernet interface representative, dp-process is the software processing process, vnet0 to vnet2 are three virtual network interface cards (NICs), and vnet0-rep to vnet2-rep are three virtual NIC representative ports. Combined with... Figure 1 As can be seen, the ECMP routing process in the traditional solution is as follows:
[0049] 1) After receiving uplink traffic on the eth port, the DPU will send it to the eth-rep port;
[0050] 2) Multi-level flow table matching of packet content is performed using dp_process to determine the routing group for ECMP routing, such as... Figure 1 As shown, the group has three members: vnet0~vnet2; calculate hash_val according to the DPHASH algorithm (hash algorithm), and then take the modulo of the number of members in the routing group to get the final route mod_val(2), which corresponds to vnet2;
[0051] 3) Send traffic to vnet2-rep;
[0052] 4) Send traffic to vnet2 via vnet2-rep so that the device corresponding to vnet2 can receive the traffic that has arrived after being routed by ECMP.
[0053] As can be seen from the above, traditional ECMP routing solutions require multi-level flow tables, and the multi-level flow table matching process is complex and lengthy, impacting OVS performance. Furthermore, ECMP relies on the DPHASH algorithm to calculate a DPHASH value, which also affects OVS performance. After ECMP routing is completed, software is used to forward traffic, consuming significant CPU (Central Processing Unit) resources. After routing, editing of fields such as port, IP address, and MAC address in the original packets may be necessary, further consuming substantial software resources. Therefore, because the complex ECMP process in traditional solutions is completed in software, it significantly impacts OVS's core business under high traffic conditions.
[0054] Therefore, this solution discloses a message forwarding method, apparatus, device and storage medium based on ECMP. This solution can use the hardware offload function of OVS to offload the ECMP routing function that was originally handled by software to hardware, thereby relieving the pressure on the software, avoiding the occupation of a large amount of resources by a single service, and allowing OVS to focus on traffic forwarding control and other core services.
[0055] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0056] See Figure 2 The present invention provides a schematic flowchart of a packet forwarding method based on ECMP, which is applied to hardware and specifically includes the following steps:
[0057] S101, Receive the original message;
[0058] In this scheme, the original packet can be either the first packet sent to the target IP address or a non-first packet sent to the target IP address. The packet forwarding method described in this scheme is based on a hardware perspective. After receiving the original packet, the hardware can determine the packet type by checking whether the original packet matches the routing flow table, and then determine whether the ECMP routing forwarding function of the original packet needs to be implemented through hardware or software.
[0059] S102. Determine if a target routing flow table exists that matches the original message;
[0060] If it exists, execute S103; if it does not exist, execute S104.
[0061] In this embodiment, the routing flow table stored in the hardware is the routing flow table issued by the software through the offload interface. To distinguish them, this scheme refers to the routing flow table that matches the original packet as the target routing flow table. When determining whether there is a target routing flow table that matches the original packet, this scheme can search for whether there is a matching target routing flow table based on the target IP address in the original packet. Matching means that the target IP address recorded in the target routing flow table is the same as the target IP address of the original packet. If a destination routing flow table matching the original packet exists in the hardware, it means that the software has generated a routing flow table for the destination IP address and offloaded it to the hardware, and the original packet is considered non-first packet traffic. If a destination routing flow table matching the original packet does not exist in the hardware, it means that the software has not yet generated a routing flow table for the destination IP address, and the original packet is considered non-first packet traffic. It should be noted that when determining whether a destination routing flow table matching the original packet exists, this solution can not only search by the destination IP address, but also by fields such as TCP (Transmission Control Protocol), UDP (User Datagram Protocol), source IP, and port. There are no specific limitations here.
[0062] S103. Execute ECMP routing and forwarding actions directly using the target routing flow table;
[0063] In this embodiment, if a target routing flow table exists in the hardware that matches the original packet, the hardware can directly perform ECMP routing and forwarding actions based on the target routing flow table. Specifically, the target routing flow table records all members of ECMP routing, and then the member that needs to forward the packet is determined by flow table matching, and the original packet is forwarded to the corresponding network device through that member.
[0064] S104. Send the original message to the software so that the software can perform ECMP routing and forwarding on the original message and unload the generated routing flow table to the hardware.
[0065] In this embodiment, if no target routing flow table matching the original packet exists in the hardware, it indicates that the original packet is not the first packet of traffic. In this case, the original packet needs to be sent to the software. After receiving the original packet, the software will perform ECMP routing and forwarding, and offload the generated routing flow table to the hardware. In this way, when the hardware receives a packet matching the routing flow table, it can directly perform ECMP routing and forwarding. See also Figure 3 This invention provides an overall flowchart of ECMP routing. Figure 3 The ASIC chip (Application Specific Integrated Circuit) in this embodiment is the hardware, and OVS-DPDK is the software. Figure 3 As can be seen, the ECMP routing process includes the following steps:
[0066] 1) The ASIC chip in the DPU receives the original packet sent by eth, matches the original packet with the flow table, and if no match is found, forwards the original packet to the OVS-DPDK software to start the first packet uploading process.
[0067] 2) After receiving the original packet through the eth-rep port, the dp_process of the OVS-DPDK software performs a flow table lookup and executes the ECMP routing action, while generating an accurate flow table for ECMP routing; this accurate flow table is the routing flow table offloaded to the hardware.
[0068] 3) dp_process sends the raw message to vnet2-rep;
[0069] 4) If unloading is enabled when the OVS-DPDK software performs an action, the precise flow table of ECMP routing will be unloaded to the ASIC chip. The action of the flow table includes all members of the ECMP routing group: dport: vnet0, vnet1, vnet2.
[0070] 5) Send the original packet to vnet2 via vnet2-rep so that the device corresponding to vnet2 can receive the original packet that has arrived after being routed by ECMP;
[0071] 6) After the ASIC chip receives a packet, if the flow table matches, it will directly process the packet and perform ECMP routing and forwarding actions.
[0072] 7) The ASIC chip forwards the message to vnet2 so that the device corresponding to vnet2 can receive the original message that has arrived after being routed by ECMP.
[0073] As can be seen from the above process, if the message is the first packet of traffic, then the following process is executed.
[0074] 1->2->3->4->5, if it is not the first packet of traffic, then proceed to step 6->7.
[0075] It should be noted that this embodiment is only illustrated using an ASIC chip as the hardware and a virtual switch as the software. In actual applications, the appropriate hardware can be selected based on the actual situation, and there are no specific limitations here.
[0076] As can be seen from the above process, by offloading the routing flow table to the hardware, the hardware can directly perform ECMP routing and forwarding actions after receiving a packet that matches the routing flow table. This avoids the large amount of resources consumed when implementing ECMP in software, greatly reducing the burden on the software and allowing the software to focus on core business processing. Compared with existing software solutions, this solution can provide better replication performance and reduce CPU consumption for the software.
[0077] See Figure 4 The present invention provides a schematic diagram of another ECMP-based packet forwarding method, which is applied to hardware and specifically includes the following steps:
[0078] S201, Receive the original message;
[0079] S202. Determine the target IP address of the original message;
[0080] S203. Check if a matching first-level routing flow table exists based on the target IP address;
[0081] If it does not exist, it is determined that there is no target routing flow table that matches the original message, and S204 is executed.
[0082] If it exists, determine that there is a target routing flow table that matches the original message, and execute S205;
[0083] S204. Send the original message to the software so that the software can perform ECMP routing and forwarding on the original message and unload the generated routing flow table to the hardware.
[0084] S205. Determine the number of routing members and their associated IDs from the first-level routing flow table;
[0085] S206. Calculate the hash value using the five-tuple of the original message, and take the modulo of the hash value according to the number of routing members to obtain the modulo value;
[0086] S207. Find the matching second-level routing flow table by association ID and modulo value, and determine the member exit information according to the second-level routing flow table;
[0087] S208. Use the member exit information to forward the original message to the corresponding device.
[0088] It should be noted that the routing flow table in the hardware is a two-level flow table, which includes a first-level flow table and a second-level flow table. Each flow table includes a key (matching item) and an action (action set). The key of the first-level flow table is the destination IP address, TCP, UDP, source IP, etc. In this scheme, only the destination IP address is used as an example for explanation. The action of the first-level flow table includes: ECMP routing action + number of routing members + the association ID (IdentityDocument) of the first-level flow table. The ECMP routing action is used to indicate whether the packet needs ECMP routing. The association ID is used to distinguish the two-level flow tables with different ECMP routing. For example, the association ID corresponding to destination IP address 1 is 1, and the association ID corresponding to destination IP address 2 is 2. The key of the second-level flow table is the association ID of the first-level flow table + member group number. The action of the second-level flow table includes: the exit information dport corresponding to the member number and packet editing related information. Furthermore, the number of second-level flow tables depends on the number of ECMP member groups. The number of second-level flow tables that the software needs to send to the hardware depends on the number of members. For example, if the association ID is 1 and there are 3 routing members numbered from 0 to 2, then the second-level flow tables include three, with keys 1-0, 1-1, and 1-2 respectively.
[0089] This scheme determines whether a target routing flow table matching the original packet exists by matching the target IP address of the original packet with the key of the first-level routing flow table. If the key of the first-level routing flow table is the same as the target IP address, then a matching target routing flow table is determined to exist.
[0090] See Figure 5 The main process diagram of ECMP route selection and offloading provided in this embodiment of the invention shows that the process of software executing S204 includes the following steps:
[0091] S301. The software receives the message sent by the hardware, performs ECMP routing, and generates a routing flow table.
[0092] S302. Determine whether the flow table unloading function is enabled;
[0093] If yes, then execute S303; otherwise, end the process.
[0094] S303. Determine whether the action in the first-level flow table includes ECMP routing actions;
[0095] If yes, execute S304; otherwise, end the process.
[0096] S304. The generated routing flow table is sent to the hardware via the offload interface.
[0097] After the routing flow table is offloaded to the hardware through the above process, the hardware can directly route and forward traffic sent to the same target IP address through the same routing flow table.
[0098] Specifically, after receiving the original packet, the hardware matches the original packet with the key in the first-level routing flow table. If a match is found, hardware ECMP routing and forwarding are performed. During ECMP routing and forwarding, the hardware retrieves the action from the matched first-level routing flow table to obtain the number of ECMP group members and the flow table association ID. Then, the hardware extracts the 5-tuple of the original packet, calculates the hash value using the DPHASH algorithm, and then takes the modulo of the number of ECMP group members to obtain the routing index mod_val. Then, the association ID + mod_val is used to form the key to match the second-level routing flow table, and the matching action of the second-level routing flow table is retrieved to obtain the final routing member exit information dport, and the traffic forwarding is completed.
[0099] It is understandable that after determining the member exit information based on the second-level routing flow table, this solution can also determine whether the original packet needs to be edited based on the matching second-level routing flow table. If so, the original packet is edited, and then the edited original packet is forwarded to the corresponding device using the member exit information; otherwise, the original packet is directly forwarded to the corresponding device using the member exit information. In this embodiment, when determining whether the original packet needs to be edited, the main focus is on whether the source IP address and source MAC address of the original packet need to be edited. However, in practical applications, other content that needs to be edited can be modified and added according to the actual situation, and this solution does not specifically limit this.
[0100] To clearly explain this solution, the process of hardware execution of ECMP routing and forwarding actions is described in detail here, taking into account the various modules in the ASIC chip. See [link to relevant documentation]. Figure 6 The overall flowchart of the hardware execution of ECMP routing and forwarding actions provided in this embodiment of the invention is illustrated in Table 1. Figure 6 The functions of each module in the document are explained below:
[0101] Table 1
[0102]
[0103]
[0104] The process of hardware performing ECMP routing and forwarding actions includes the following steps:
[0105] 1) The RX receives the raw message, parses the message's METADATA, and provides it to the L1 Process for flow table lookup processing.
[0106] 2) Match the L1 process to the L1 Flow Table. If a matching first-level routing flow table exists, mark the action information of the matched first-level routing flow table: number of ECMP members (3) + association ID of the multi-level flow table (1).
[0107] 3) The original message is sent to the L2 Process. Based on the action information in the first-level routing flow table, the DPHASH template is filled: MOD_EN(1) + MOD(3) + quintuple. The DPHASH calculation will yield a modulo value mod_val(1).
[0108] 4) The original message is sent to the L3 Process. Based on the information obtained in steps 2 and 3, a key is formed: the association id (1) of the multi-level flow table + mod_val (1). This key is then matched against the second-level routing flow table in the L3 flow table to obtain the action information of the matching second-level routing flow table; for example... Figure 6 As shown, the actions corresponding to keys 1-1 include: dport:1, set_sip:1, sip_idx:2, set_smac:1, and smac_idx:2.
[0109] 5) The original packet is sent to Pkt Edit. Based on the action information of the matching second-level routing flow table, it is determined that the packet needs to be edited. Since sip_idx and smac_idx are both 2, the IP and MAC in the original packet are modified to the corresponding values with index 2 in the Edit Table. That is, the source IP of the packet will be modified to 1.1.1.2, and the source MAC will be modified to 02:03:04:05:06:07.
[0110] 6) The modified message is sent to TX, and based on the dport information, the message is forwarded to the corresponding device.
[0111] As can be seen from the above process, this solution proposes a technical approach to offload the ECMP routing process to hardware. By utilizing the OFFLOAD standard interface supported by OVS-DPDK, the ECMP routing service is offloaded to hardware, reducing the burden on the software and allowing it to focus on core business processing. Compared with existing software solutions, this solution provides better replication performance, enabling the hardware to use the routing flow table generated by the software for ECMP routing, thus reducing CPU consumption for the software.
[0112] The following describes the message forwarding apparatus, device, and storage medium provided in the embodiments of the present invention. The message forwarding apparatus, device, and storage medium described below can be referred to in conjunction with the message forwarding method described above.
[0113] See Figure 7 This invention provides a schematic diagram of a packet forwarding device based on ECMP. This packet forwarding device is applied in hardware, and the packet forwarding hardware includes:
[0114] Message receiving module 11 is used to receive raw messages;
[0115] The judgment module 12 is used to determine whether a target routing flow table matching the original message exists;
[0116] Forwarding module 13 is used to directly execute ECMP routing and forwarding actions using the target routing flow table when a target routing flow table that matches the original packet exists.
[0117] The sending module 14 is used to send the original packet to the software when there is no target routing flow table that matches the original packet, so that the software can perform ECMP routing forwarding on the original packet and offload the generated routing flow table to the hardware.
[0118] The judgment module includes:
[0119] The first determining unit is used to determine the target IP address of the original message;
[0120] The first lookup unit is used to search for whether a matching first-level routing flow table exists based on the target IP address; if it exists, it is determined that a target routing flow table matching the original packet exists; if it does not exist, it is determined that a target routing flow table matching the original packet does not exist.
[0121] The forwarding module includes:
[0122] The second determining unit is used to determine the number of routing members and their associated IDs from the first-level routing flow table;
[0123] The calculation unit is used to calculate the hash value using the five-tuple of the original message, and to take the modulo of the hash value according to the number of routing members to obtain the modulo value;
[0124] The second lookup unit is used to find a matching second-level routing flow table through the association ID and the modulo value, and to determine the member exit information based on the second-level routing flow table;
[0125] The forwarding unit is used to forward the original message to the corresponding device using the member exit information.
[0126] The judgment module also includes:
[0127] The judgment unit is used to determine whether the original packet needs to be edited based on the matching second-level routing flow table; if so, the editing unit is triggered.
[0128] An editing unit is used to edit the original message;
[0129] The forwarding unit is used to forward the edited original message to the corresponding device using the member exit information when the original message needs to be edited; and to directly forward the original message to the corresponding device using the member exit information when the original message does not need to be edited.
[0130] Specifically, the judgment unit is used to determine whether the source IP address and source MAC address of the original message need to be edited.
[0131] The hardware is an ASIC chip, and the software is a virtual switch.
[0132] The device further includes:
[0133] The flow table receiving module is used to receive the routing flow table sent by the software through the offload interface.
[0134] See Figure 8 The present invention provides a schematic diagram of an electronic device structure, comprising:
[0135] Memory 21 is used to store computer programs;
[0136] The processor 22 is configured to implement the steps of the ECMP-based packet forwarding method described in any of the above method embodiments when executing the computer program.
[0137] In this embodiment, the device includes the hardware and software described in any of the above embodiments. The device can be a PC (Personal Computer), or a terminal device such as a smartphone, tablet computer, handheld computer, or portable computer.
[0138] The device may include a memory 21, a processor 22, and a bus 23.
[0139] The memory 21 includes at least one type of readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 21 can be an internal storage unit of the device, such as the hard disk of the device. In other embodiments, the memory 21 can also be an external storage device of the device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 21 can include both internal and external storage units of the device. The memory 21 can be used not only to store application software and various types of data installed on the device, such as program code executing message forwarding methods, but also to temporarily store data that has been output or will be output.
[0140] In some embodiments, processor 22 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip, used to run program code stored in memory 21 or process data, such as program code for executing message forwarding methods.
[0141] This bus 23 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0142] Furthermore, the device may also include a network interface 24, which may optionally include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), typically used to establish communication connections between the device and other electronic devices.
[0143] Optionally, the device may further include a user interface 25, which may include a display, an input unit such as a keyboard, and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the device and to display a visual user interface.
[0144] Figure 8 Only devices with components 21-25 are shown; those skilled in the art will understand that... Figure 8 The structure shown does not constitute a limitation on the device and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0145] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the ECMP-based packet forwarding method described in any of the above method embodiments.
[0146] The storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0147] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0148] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A message forwarding method based on ECMP, characterized in that, The message forwarding method is applied to hardware, and the message forwarding includes: Receive raw messages; Determine whether a target routing flow table exists that matches the original message; If it exists, the ECMP routing and forwarding action is directly executed using the target routing flow table; wherein, the routing flow table in the hardware is a two-level flow table, which includes: a first-level routing flow table and a second-level routing flow table, and each flow table includes a key and an action; If it does not exist, the original message is sent to the software so that the software performs ECMP routing and forwarding on the original message and offloads the generated routing flow table to the hardware. Specifically, directly executing ECMP routing and forwarding actions using the target routing flow table includes: The number of routing members and their associated IDs are determined from the first-level routing flow table; a hash value is calculated using the 5-tuple of the original message; the hash value is moduloed by the number of routing members to obtain a modulo value; a matching second-level routing flow table is searched using the associated ID and the modulo value, and member exit information is determined based on the second-level routing flow table; wherein, the second-level routing flow table is matched using the key composed of the associated ID and the modulo value, and the action of the matching second-level routing flow table is obtained to obtain the final routing member exit information; The original message is forwarded to the corresponding device using the member exit information.
2. The message forwarding method according to claim 1, characterized in that, The determination of whether a target routing flow table matches the original message includes: Determine the target IP address of the original message; Based on the target IP address, check if a matching first-level routing flow table exists; If it exists, it is determined that a target routing flow table matching the original message exists; if it does not exist, it is determined that no target routing flow table matching the original message exists.
3. The message forwarding method according to claim 2, characterized in that, After determining the member exit information based on the second-level routing flow table, the following is also included: Determine whether the original message needs to be edited based on the matching second-level routing flow table; If so, the original message is edited, and the edited original message is forwarded to the corresponding device using the member exit information; If not, the original message will be forwarded directly to the corresponding device using the member exit information.
4. The message forwarding method according to claim 3, characterized in that, The determination of whether the original message needs to be edited includes: Determine whether the source IP address and source MAC address of the original message need to be edited.
5. The message forwarding method according to claim 1, characterized in that, The hardware is an ASIC chip, and the software is a virtual switch.
6. The message forwarding method according to any one of claims 1 to 5, characterized in that, After the original message is sent to the software, the following steps are included: Receive the routing flow table sent by the software through the offload interface.
7. A message forwarding device based on ECMP, characterized in that, The message forwarding device is applied in hardware, and the message forwarding device includes: The message receiving module is used to receive raw messages; The judgment module is used to determine whether a target routing flow table matching the original message exists; The forwarding module is used to directly execute ECMP routing and forwarding actions using the target routing flow table when a target routing flow table matching the original packet exists. The routing flow table in the hardware is a two-level flow table, which includes a first-level routing flow table and a second-level routing flow table. Each flow table includes a key and an action. The sending module is used to send the original packet to the software when there is no target routing flow table that matches the original packet, so that the software can perform ECMP routing forwarding on the original packet and offload the generated routing flow table to the hardware. The forwarding module includes: The second determining unit is used to determine the number of routing members and their associated IDs from the first-level routing flow table; The calculation unit is used to calculate the hash value using the five-tuple of the original message, and to take the modulo of the hash value according to the number of routing members to obtain the modulo value; The second lookup unit is used to find a matching second-level routing flow table using the associated ID and the modulo value, and to determine the member exit information based on the second-level routing flow table; wherein, the second-level routing flow table is matched using the key formed by the associated ID and the modulo value, and the action of the matching second-level routing flow table is obtained to obtain the member exit information of the final route selection; The forwarding unit is used to forward the original message to the corresponding device using the member exit information.
8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the ECMP-based message forwarding method as described in any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the ECMP-based message forwarding method as described in any one of claims 1 to 6.