Tunnel Encapsulation Table Resource Management Methods, DPU and Related Equipment

By not storing VNI information in the tunnel encapsulation table and writing the VNI field to 0 during hardware unloading, a precise flow table for downlink tunnel encapsulation and a tunnel encapsulation table are generated, which solves the problem of hardware resource bloat in tunneling technology and achieves hardware resource saving.

CN116996478BActive Publication Date: 2026-05-26ZHUHAI XINGYUN ZHILIAN TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHUHAI XINGYUN ZHILIAN TECH CO LTD
Filing Date
2023-06-13
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In the implementation of tunneling technology, there is a problem of hardware resource inflation, especially the large amount of duplicate content in the tunnel encapsulation table, which leads to a waste of memory resources.

Method used

By not storing VNI information in the tunnel encapsulation table and writing the VNI field to 0 during the hardware unloading process, a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table are generated. The processor unloads the tunnel encapsulation table and flow table corresponding to the encapsulation index, and the virtual switch sends the VNI to the hardware through the behavior field for VNI replacement.

Benefits of technology

This saves hardware resources for the tunnel encapsulation table, avoids hardware resource inflation, and reduces the hardware burden.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116996478B_ABST
    Figure CN116996478B_ABST
Patent Text Reader

Abstract

This application discloses a tunnel encapsulation table resource management method, a DPU, and related devices. The method includes: a processor receiving a first packet sent by the network side, the first packet including a first message; matching the flow table according to the first message; if no hardware flow table is matched, forwarding the first packet to a virtual switch to perform software forwarding of the first message; the virtual switch editing and encapsulating the first message into a tunnel message, calculating the first port number of the outgoing port of the first message, and generating a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table; the downlink tunnel encapsulation precise flow table includes a first action field, the first action field including a first port number, a first encapsulation action, a first encapsulation index, and a first VNI extracted from the tunnel encapsulation table; writing 0 to the VNI field in the tunnel encapsulation table in the tunnel; and the processor unloading the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table. Using this application embodiment can save hardware resources occupied by the tunnel encapsulation table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network communication technology, specifically to a tunnel encapsulation table resource management method, a DPU, and related equipment. Background Technology

[0002] In cloud computing data centers, the most fundamental technology for network virtualization is layering. Currently, mainstream tunneling technologies divide the network into Underlay and Overlay. Underlay refers to the physical network, composed of physical devices and links. Overlay is a tunneling technology; VXLAN, NVGRE, and GENEVE are three typical examples, all achieving Layer 2 network isolation through tunneling. The principle of tunneling technology is to encapsulate the original Layer 2 data frames from Overlay and transmit them through Underlay. Without modifying the existing physical network, tunneling technology creates multiple virtual networks on the existing physical network, achieving automation and intelligence in the data center.

[0003] In practical applications, hardware offloading is usually required in the implementation of tunneling technology. However, after hardware offloading is enabled, many tunnel encapsulation entries are sent to the hardware. These tunnel encapsulation entries contain a lot of duplicate content, which causes the use of hardware resources to swell. Therefore, the problem of how to save memory resources in the tunneling process needs to be solved. Summary of the Invention

[0004] This application provides a tunnel encapsulation table resource management method, a DPU, and related equipment, which can save hardware resources during tunnel implementation.

[0005] In a first aspect, embodiments of this application provide a tunnel encapsulation table resource management method, applied to a data processor (DPU), wherein the DPU includes a processor and a controller, and the controller includes a virtual switch; the method includes:

[0006] The processor receives the first packet sent by the network side, the first packet including a first message;

[0007] The processor matches the flow table according to the first packet; if the hardware flow table is not matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first packet.

[0008] The virtual switch edits and encapsulates the first packet into a tunnel packet, calculates the first port number of the outgoing port of the first packet, and generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the packet content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes the first port number, the first encapsulation action, the first encapsulation index, and the first VNI extracted from the tunnel encapsulation table.

[0009] The virtual switch writes 0 to the VNI field in the tunnel encapsulation table within the tunnel.

[0010] The processor unloads the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, and sends the first packet out to the outgoing port corresponding to the first port number.

[0011] Secondly, embodiments of this application provide a data processor (DPU), characterized in that the DPU includes a processor and a controller, the controller including a virtual switch, wherein...

[0012] The processor is configured to receive a first packet sent by the network side, the first packet including a first message;

[0013] The processor is further configured to match the flow table according to the first packet; if the flow table is not matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first packet;

[0014] The virtual switch is used to edit and encapsulate the first packet into a tunnel packet, calculate the first port number of the outgoing port of the first packet, and generate a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the packet content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes the first port number, a first encapsulation action, a first encapsulation index, and a first VNI extracted from the tunnel encapsulation table.

[0015] The virtual switch is also used to write 0 to the VNI field in the tunnel encapsulation table in the tunnel.

[0016] The processor is further configured to unload the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, and send the first packet out to the outgoing port corresponding to the first port number.

[0017] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for performing the steps in the first aspect of embodiments of this application, and the electronic device includes a data processing unit (DPU).

[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program for electronic data interchange, wherein the computer program causes a computer to perform some or all of the steps described in the first aspect of embodiments of this application.

[0019] Fifthly, embodiments of this application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps described in the first aspect of embodiments of this application. The computer program product may be a software installation package.

[0020] Implementing the embodiments of this application has the following beneficial effects:

[0021] As can be seen, the tunnel encapsulation table resource management method, DPU, and related devices described in the embodiments of this application are applied to a data processor (DPU). The DPU includes a processor and a controller. The controller includes a virtual switch. The processor receives the first packet sent by the network side. The first packet includes a first message. The processor matches the flow table according to the first message. If no hardware flow table is matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first message. The virtual switch edits and encapsulates the first message into a tunnel message, calculates the first port number of the outgoing port of the first message, and generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the message content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes a first port number, a first... The encapsulation action, the first encapsulation index, and the first VNI extracted from the tunnel encapsulation table are processed. The virtual switch writes the VNI field in the tunnel encapsulation table within the tunnel to 0. The processor unloads the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, and sends the first packet out to the outgoing port corresponding to the first port number. Since the VNI information is not placed in the tunnel encapsulation table, it will not cause an increase in hardware resource usage. In addition, after the first packet upcall, the virtual switch (OVS) sends the VNI to the hardware through the action field. After the hardware matches and hits the flow table, it can obtain the action to replace the VNI without causing additional hardware burden. That is, the VNI field in the tunnel encapsulation table within the tunnel is written to 0, thereby saving hardware resources of the tunnel encapsulation table. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a schematic diagram of the structure of a data processor (DPU) provided in an embodiment of this application;

[0024] Figure 2 This is a flowchart illustrating a tunnel encapsulation table resource management method provided in an embodiment of this application;

[0025] Figure 3 This is a flowchart illustrating another tunnel encapsulation table resource management method provided in an embodiment of this application;

[0026] Figure 4 This is a flowchart illustrating another tunnel encapsulation table resource management method provided in an embodiment of this application;

[0027] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0028] Figure 6 This is a functional unit block diagram of another DPU provided in the embodiments of this application. Detailed Implementation

[0029] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0030] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0031] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0032] In specific implementations, the electronic devices involved in the embodiments of this application can be any electronic device including a DPU. The electronic devices may include, but are not limited to: smartphones, tablets, smart robots, smart projectors, conferencing equipment, in-vehicle equipment, wearable devices, servers, network equipment, computing devices or other processing devices connected to a wireless modem, as well as various forms of user equipment (UE), mobile station (MS), terminal device, etc., which are not limited here.

[0033] In this embodiment, a tunnel header is added to the original packet sent from the OverLay network, allowing the tunnel packet to be transparently transmitted in the UnderLay network. The tunnel header contains a VNI field to identify different tenants. On the VTEP device establishing the tunnel, when performing tunnel encapsulation in the outbound direction, different tenant information needs to be mapped to different VNIs for tunnel packet encapsulation. When performing tunnel decapsulation in the inbound direction, the tunnel packet needs to be sent to different tenants based on the VNI of the tunnel packet. When OVS forwards tunnel packets, an inbound tunnel decapsulation table is generated for tunnel decapsulation, and an outbound tunnel encapsulation table is generated for tunnel encapsulation. The tunnel encapsulation table generated by OVS carries VNI information. After the original packet matches the OVS flow table, the tunnel header from the generated tunnel encapsulation table is added to the original packet to generate the tunnel packet.

[0034] In this embodiment, OVS (Open vSwitch) refers to the Open vSwitch standard. Specifically, Open vSwitch is a product-quality, multi-tiered virtual switching standard licensed under the open-source Apache 2.0 license. It aims to automate (configuration, management, and maintenance) large networks through programmatic extensions, while also supporting standard management interfaces and protocols (such as NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, and 802.1ag). In general, it is designed to support distribution across multiple physical servers, such as VMware's vNetwork distributed vSwitch or Cisco's Nexus 1000V. Virtual switching utilizes a virtual platform to form switch components through software.

[0035] In this embodiment, DPDK, or Intel Data Plane Development Kit, is a data plane development toolset provided by Intel. DPDK provides library functions and drivers to support efficient packet processing in user space under the Intel Architecture (IA) processor architecture. DPDK can be understood as a software library used to accelerate packet data processing.

[0036] In this embodiment, the data processing unit (DPU) is a major category of newly developed dedicated processors. Following CPUs and GPUs, it is the third important computing chip in data center scenarios, providing a computing engine for high-bandwidth, low-latency, and data-intensive computing scenarios. The DPU acts as an offloading engine for the CPU, freeing up CPU computing power for upper-layer applications.

[0037] Please see Figure 1 This application provides a schematic diagram of the structure of a data processor (DPU) 10. The DPU 10 may include a controller 130 and a processor 120. The controller 130 may include a virtual switch 131. The controller 130 is connected to the processor 120. The processor receives packets (first packet, second packet, etc.) through a first network port 110. The virtual switch 131 is used for software forwarding and hardware offloading.

[0038] In specific implementation, such as Figure 1 As shown in paths 1 to 4, in path 1, the processor receives the packet during software forwarding and then performs flow table matching based on the packet. If no matching flow table is found, it is considered the first packet and is forwarded to the virtual switch. In path 2, the virtual switch 131 forwards the packet through the first rep port ( Figure 1 In path 3, the virtual switch receives the packet via the second rep port (rep1) and then encapsulates the received packet; in path 3, the virtual switch transmits the encapsulated packet through the second rep port (rep1). Figure 1 In path 4, the processor 120 forwards the data from rep2 to the external network via the second network port 140 (Ethernet port).

[0039] In path 4, during hardware unloading, virtual switch 131 generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table stores the packet content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes a first port number, a first encapsulation action, a first encapsulation index, and a first VNI extracted from the tunnel encapsulation table. The VNI field in the tunnel encapsulation table is written to 0 and sent to processor 120. As shown in paths 5 and 6, in path 5, processor 120 receives the packet, matches it with the flow table, performs hardware forwarding directly, finds the outgoing interface, adds the encapsulation content based on the tunnel encapsulation index in the tunnel encapsulation table, adds the encapsulation content to the original packet, and then replaces the VNI to obtain the tunnel packet. In path 6, processor 120 sends the tunnel packet to the second network port 140, which forwards the tunnel packet to the external network.

[0040] This allows the VNI field in the tunnel encapsulation table to be written to 0 during the flow table hardware unloading process, thereby saving hardware resources of the tunnel encapsulation table.

[0041] For example, the specific implementation may include the following steps:

[0042] S1, such as path 1: The hardware (processor) receives the first packet of traffic sent by virtio-net, matches the flow table according to the packet, and if no match is found, it will go through software forwarding and follow the first packet uploading process.

[0043] S2, such as path 2: The software of the controller (Ecpu side) receives the packet and forwards it through the virtio-net rep port. The packet is encapsulated into a tunnel packet by OVS and the packet output port is calculated to be the eth rep port. At the same time, a downlink tunnel encapsulation precise flow table is generated.

[0044] S3, such as path 3: The hardware receives the message sent by the software, the output port is eth, and it is forwarded to the external network;

[0045] S4, such as path 4: If offloading is enabled during software forwarding, the downlink tunnel encapsulation precise flow table is offloaded to the hardware. The action of the flow table includes the action "encap", the encapsulation index "encap_idx", and the VNI extracted from the encapsulation tunnel table. At the same time, the VNI field in the tunnel table is written to 0 and the tunnel encapsulation table corresponding to the encapsulation index is offloaded. The tunnel encapsulation table stores the packet content that needs to be encapsulated.

[0046] S5, such as path 5: If the hardware receives the same message later, it will query the flow table and find the hit. It will then perform hardware forwarding, find the outgoing interface, add the hardware forwarding, and then index the encapsulation content in the tunnel encapsulation table according to the tunnel encapsulation index. The encapsulation content will be added to the original message and then the VNI will be replaced.

[0047] S6, such as path 6: send the message out of the eth interface.

[0048] The embodiments of this application will be described in detail below.

[0049] Please see Figure 2 , Figure 2 This is a flowchart illustrating a tunnel encapsulation table resource management method provided in an embodiment of this application, applicable to, for example... Figure 1 The data processor (DPU) shown includes a processor and a controller, the controller including a virtual switch. The tunnel encapsulation table resource management method may include the following steps:

[0050] 201. The processor receives the first packet sent by the network side, the first packet including a first message.

[0051] In this embodiment, the Data Processor (DPU) may include a processor and a controller, with the controller including a virtual switch. Specifically, the network side can be understood as the network device side between the DPUs. The processor can receive the first packet sent by the network side; specifically, traffic initiated from virtio-net is referred to as downlink traffic.

[0052] 202. The processor matches the flow table according to the first packet; if no hardware flow table is matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first packet.

[0053] In this embodiment, the processor can match the flow table according to the first packet. If the hardware flow table is not matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first packet.

[0054] In this embodiment, the processor queries the hardware flow table that has been offloaded to the hardware via OVS. In contrast, there is also the OVS software flow table, called the software datapath flow table, which is generated by querying the ovsopenflow flow table when the first packet is sent. When the packet does not hit the hardware upcall, it will first check the software datapath flow table. If it does not hit the hardware upcall, it will then check the openflow flow table for matching, thereby generating the software datapath flow table. This datapath flow table is the data source that is offloaded to the hardware flow table.

[0055] Optionally, the following steps may also be included:

[0056] The processor receives a second packet sent by the network side; the processor matches the flow table according to the second packet; if a hardware flow table is matched, the processor obtains the second action field of the matched hardware flow table, the second action field including: the second port number of the outgoing port of the second packet, the second encapsulation operation, the second encapsulation index and the second VNI; the processor obtains the corresponding tunnel encapsulation table according to the second encapsulation index and forwards the second packet directly.

[0057] In this embodiment, the processor receives a second packet sent by the network side. The second packet is not the first packet, that is, a packet after the first packet. For example, the second packet can be the second packet received, that is, a packet forwarded by hardware. If the hardware flow table is hit, the processor can obtain the second action field of the hit flow table. The second action field includes: the second port number of the output port of the second packet, the second encapsulation operation, the second encapsulation index and the second VNI. Then, according to the second encapsulation index, the corresponding tunnel encapsulation table is obtained and the second packet is forwarded directly.

[0058] 203. The virtual switch edits and encapsulates the first packet into a tunnel packet, calculates the first port number of the outgoing port of the first packet, and generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the packet content that needs to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes the first port number, the first encapsulation action, the first encapsulation index, and the first VNI extracted from the tunnel encapsulation table.

[0059] In this embodiment, the virtual switch encapsulates the first packet into a tunnel packet using OVS editing, calculates the first port number corresponding to the outgoing port of the first packet, and then generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table stores the packet content to be encapsulated. In specific implementations, VNI information is not placed in the tunnel encapsulation table. The downlink tunnel encapsulation precise flow table includes an action field, which may include the first port number, the first encapsulation action (encap), the first encapsulation index (encap_idx), and the virtual network identification (VNI) extracted from the tunnel encapsulation table, i.e., the first VNI.

[0060] 204. The virtual switch writes 0 to the VNI field in the tunnel encapsulation table within the tunnel.

[0061] In practice, the virtual switch can set the VNI field in all tunnel encapsulation tables in the tunnel to 0. As a result, there are no longer multiple tunnel encapsulation tables in the hardware that are identical in all fields except VNI, thus saving hardware resources.

[0062] 205. The processor unloads the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, and sends the first packet out to the outgoing port corresponding to the first port number.

[0063] In this embodiment, the processor can unload the tunnel encapsulation table and the downlink tunnel encapsulation precise flow table corresponding to the encapsulation index, and send the first packet out to the outgoing port corresponding to the first port number.

[0064] In this embodiment of the application, when the OVS flow table is unloaded, the action of the software unloading the tunnel encapsulation flow table carries the VNI information obtained by the software from the tunnel encapsulation header. The tunnel encapsulation header stripped of the VNI information then determines whether to store it in the hardware tunnel encapsulation table after judging whether there is duplicate information in the tunnel encapsulation table. In this way, the hardware-stored tunnel encapsulation table can save a considerable amount of hardware resources.

[0065] Optionally, step 204 above, unloading the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, may include the following steps:

[0066] 41. Unload the downlink tunnel encapsulated precise flow table;

[0067] 42. Determine whether the tunnel encapsulation table entry corresponding to the encapsulation index has been unloaded before;

[0068] 43. If not, uninstall the tunnel encapsulation table corresponding to the previously uninstalled tunnel encapsulation table entries;

[0069] 44. If so, increase the reference count of tunnel encapsulation table entries that have not been previously unloaded.

[0070] In this embodiment, the downlink tunnel encapsulation precise flow table can be unloaded first, and then it can be determined whether the tunnel encapsulation table entry corresponding to the encapsulation index has been unloaded before. If not, the tunnel encapsulation table corresponding to the previously unloaded tunnel encapsulation table entry is unloaded. If so, it means that there are multiple flow tables sharing the same encapsulation index. In order to avoid duplicate unloading, the reference count of the tunnel encapsulation table entry that has not been unloaded before is increased, and no unloading operation is performed. Thus, it can be ensured that when different flows reference the same tunnel encapsulation table, the hardware will not have duplicate tunnel encapsulation tables. When deleting, the tunnel encapsulation table is only deleted from the hardware if the reference count is 0; otherwise, the reference count is decremented by 1.

[0071] Optionally, the following steps may also be included:

[0072] Edit the tunnel encapsulation content in the tunnel encapsulation table to the outer layer of the received first message, and modify the VNI of the outer tunnel message to the VNI in the corresponding action field.

[0073] In practice, the tunnel encapsulation content in the tunnel encapsulation table can be edited to be outside the inner layer of the received first message, and the VNI of the outer tunnel message can be modified to the VNI in the corresponding action field. That is, the VNI of the outer tunnel message can be modified to the VNI in the action of this flow. Specifically, the VNI in the action can be replaced to ensure the correctness of the tunnel message hard-forwarded.

[0074] Optionally, step 203 above generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table, including:

[0075] 31. Generate the precise flow table for the downlink tunnel encapsulation;

[0076] 32. Generate the tunnel encapsulation table based on the encapsulation index of the downlink tunnel encapsulation precise flow table. The contents of the entries in the tunnel encapsulation table are the tunnel headers that need to be encapsulated for the inner layer packets later.

[0077] In this embodiment, a downlink tunnel encapsulation precise flow table can be generated first, and then a tunnel encapsulation table can be generated based on the encapsulation index of the downlink tunnel encapsulation precise flow table. The contents of the entries in the tunnel encapsulation table are the tunnel headers that need to be encapsulated for the inner packets later. The tunnel encapsulation table does not include VNI information.

[0078] For example, in the embodiments of this application, such as Figure 3As shown, the first packet is upcalled, and OVS parses and performs soft conversion of the packet. That is, upon receiving the packet, soft conversion is performed, generating a tunnel encapsulation flow table key + action(encap + encap_idx), which generates a precise downlink tunnel encapsulation flow table. The action in the flow table includes the action "encap," and the encapsulation index is "encap_idx." A tunnel encapsulation table entry is generated based on "encap_idx." The content of the tunnel encapsulation table entry is the tunnel header that needs to be encapsulated in the inner packet later. The system then checks whether to unload the flow table. If yes (Y), it checks whether the action includes "encap." If flow table hardware offloading is enabled, the flow table is offloaded to hardware; the VNI is extracted from the tunnel encapsulation table entries, and the VNI in the tunnel encapsulation table entries is cleared to 0. Specifically, the VNI of the entry corresponding to the encapsulation index in the tunnel encapsulation table is extracted, and the VNI of the corresponding entry in the tunnel encapsulation table is cleared to 0; the tunnel encapsulation flow table key and action are offloaded. The action includes encap, encap_idx, and VNI. Specifically, the action for offloading the flow table includes the action "encap", the encapsulation index "encap_idx", and the VNI previously extracted from the tunnel encapsulation table entry corresponding to the tunnel encapsulation index; at the same time, it is checked whether the tunnel encapsulation table entry with a cleared VNI is duplicated. If not (N), the reference count of the tunnel encapsulation table entry is incremented by 1; if yes (Y), the tunnel encapsulation table entry is offloaded, i.e., if it was not offloaded before, it is offloaded; if it was offloaded before, the reference count is incremented. The tunnel encapsulation table stores the packet content that needs to be tunnel encapsulated, and the VNI in this packet information is 0.

[0079] The flow table contains a key and an action. The key is determined by whether a packet matches a certain flow table entry based on its characteristics. Only if a match is found can an action be generated.

[0080] Furthermore, such as Figure 4As shown, after the downlink encapsulation flow table is unloaded, the same traffic is directly forwarded by the hardware. Specifically, when the hardware receives a packet, it receives the packet; it matches the flow table according to the packet, i.e., the flow table action carries VNI information; it checks if the flow table is hit. If it is hit (Y), hardware forwarding is performed; if not (N), the packet is sent up and forwarded by software; it obtains the flow table action (encap + encap_idx + VNI information); it obtains the tunnel encapsulation table based on encap_idx, and forwards it in combination with the VNI in the unloaded flow table action. That is, the flow table action obtained from the query table includes the action as encap, the encapsulation index as encap_idx, and the VNI of the encapsulated tunnel packet. Meanwhile, encap_idx can index the tunnel encapsulation table, which stores the message content that needs to be tunnel encapsulated. The tunnel encapsulation content in the tunnel encapsulation table is edited to be outside the received inner message. At the same time, the VNI of the outer tunnel message is modified to the VNI in the action of that flow. That is, a VNI is retained among the same VNIs, thus ensuring the correctness of the tunnel message hard-forwarded.

[0081] In related technologies, the tunnel encapsulation table carries VNI information. During hardware hardware translation, the contents of the tunnel encapsulation table are directly added to the original packet, but this can lead to a surge in the number of entries. In this embodiment, however, the VNI information is not placed in the tunnel encapsulation table, thus avoiding an increase in hardware resource usage. Furthermore, after the first packet upcall, OVS sends the VNI to the hardware via an action. Once the hardware matches the flow table, it can obtain the action to replace the VNI without incurring additional hardware burden.

[0082] As can be seen, the tunnel encapsulation table resource management method described in this application embodiment is applied to a data processor (DPU). The DPU includes a processor and a controller. The controller includes a virtual switch. The processor receives the first packet sent by the network side. The first packet includes a first message. The processor matches the flow table according to the first message. If the hardware flow table is not matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first message. The virtual switch edits and encapsulates the first message into a tunnel message, calculates the first port number of the outgoing port of the first message, and generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the message content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes a first port number, a first encapsulation action, and so on. The virtual switch (OVS) writes the VNI field in the tunnel encapsulation table to 0, and the processor unloads the tunnel encapsulation table and the downlink tunnel encapsulation precise flow table corresponding to the encapsulation index. It then sends the first packet out to the port corresponding to the first port number. Since the VNI information is not placed in the tunnel encapsulation table, it will not cause an increase in hardware resource usage. In addition, after the first packet upcall, the OVS sends the VNI to the hardware through the action field. After the hardware matches the flow table, it can obtain the action to replace the VNI without causing additional hardware burden. That is, it writes the VNI field in the tunnel encapsulation table to 0, thereby saving hardware resources of the tunnel encapsulation table.

[0083] Consistent with the above embodiments, please refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. As shown in the figure, the electronic device includes a DPU, which includes a processor and a controller. The controller includes a virtual switch. The electronic device also includes a memory, a communication interface, and one or more programs. The one or more programs are stored in the memory and configured to be executed by the processor. In this embodiment, the programs include instructions for performing the following steps:

[0084] The processor receives the first packet sent by the network side, the first packet including a first message;

[0085] The processor matches the flow table according to the first packet; if the hardware flow table is not matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first packet.

[0086] The virtual switch edits and encapsulates the first packet into a tunnel packet, calculates the first port number of the outgoing port of the first packet, and generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the packet content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes the first port number, the first encapsulation action, the first encapsulation index, and the first VNI extracted from the tunnel encapsulation table.

[0087] The virtual switch writes 0 to the VNI field in the tunnel encapsulation table within the tunnel.

[0088] The processor unloads the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, and sends the first packet out to the outgoing port corresponding to the first port number.

[0089] Optionally, regarding the unloading of the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, the above procedure includes instructions for performing the following steps:

[0090] Unload the precise flow table of the downlink tunnel encapsulation;

[0091] Determine whether the tunnel encapsulation table entry corresponding to the encapsulation index has been unloaded before;

[0092] If not, uninstall the tunnel encapsulation table corresponding to the tunnel encapsulation table entries that were previously uninstalled.

[0093] If so, increase the reference count of tunnel encapsulation table entries that were not previously unloaded.

[0094] Optionally, the above procedure may also include instructions for performing the following steps:

[0095] Edit the tunnel encapsulation content in the tunnel encapsulation table to the outer layer of the received first message, and modify the VNI of the outer tunnel message to the VNI in the corresponding action field.

[0096] Optionally, in generating the downlink tunneling encapsulation accurate flow table and tunneling encapsulation table, the above procedure includes instructions for performing the following steps:

[0097] Generate the precise flow table for the downlink tunnel encapsulation;

[0098] The tunnel encapsulation table is generated based on the encapsulation index of the downlink tunnel encapsulation precise flow table. The entries in the tunnel encapsulation table contain the tunnel headers that need to be encapsulated in the inner layer packets later.

[0099] Optionally, the above procedure may also include instructions for performing the following steps:

[0100] The processor receives a second message sent from the network side;

[0101] The processor matches the flow table according to the second message;

[0102] If a hardware flow table is hit, the processor obtains the second action field of the hit hardware flow table. The second action field includes: the second port number of the outgoing port of the second packet, the second encapsulation operation, the second encapsulation index, and the second VNI. Based on the second encapsulation index, the processor obtains the corresponding tunnel encapsulation table and forwards the second packet directly.

[0103] As can be seen, the electronic device described in this application embodiment includes a DPU, which includes a processor and a controller. The controller includes a virtual switch. The processor receives the first packet sent by the network side, and the first packet includes a first message. The processor matches the flow table according to the first message. If the hardware flow table is not matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first message. The virtual switch edits and encapsulates the first message into a tunnel message, calculates the first port number of the outgoing port of the first message, and generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the message content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes a first port number, a first encapsulation action, and a first encapsulation method. The virtual switch (OVS) indexes and extracts the first VNI from the tunnel encapsulation table. It then writes the VNI field in the tunnel encapsulation table to 0. The processor unloads the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, and sends the first packet out to the port corresponding to the first port number. Since the VNI information is not stored in the tunnel encapsulation table, it does not cause hardware resource usage inflation. Furthermore, after the first packet upcall, the OVS sends the VNI to the hardware via the action field. Once the hardware matches the flow table, it can obtain the action to replace the VNI, without causing additional hardware burden. This is achieved by writing the VNI field in the tunnel encapsulation table to 0, thus saving hardware resources allocated to the tunnel encapsulation table.

[0104] Figure 6 This is a functional unit block diagram of a DPU600 involved in the embodiments of this application. The DPU includes a processor and a controller, the controller including a virtual switch, wherein...

[0105] The processor 601 is configured to receive a first packet sent by the network side, the first packet including a first message;

[0106] The processor 601 is further configured to match the flow table according to the first packet; if the flow table is not matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first packet.

[0107] The virtual switch 602 is used to edit and encapsulate the first packet into a tunnel packet, calculate the first port number of the outgoing port of the first packet, and generate a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the packet content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes the first port number, a first encapsulation action, a first encapsulation index, and a first VNI extracted from the tunnel encapsulation table.

[0108] The virtual switch 602 is also used to write 0 to the VNI field in the tunnel encapsulation table in the tunnel;

[0109] The processor 601 is further configured to unload the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, and send the first packet out to the outgoing port corresponding to the first port number.

[0110] Optionally, in unloading the tunnel encapsulation table corresponding to the encapsulation index and the downlink tunnel encapsulation precise flow table, the processor is specifically configured to:

[0111] Unload the precise flow table of the downlink tunnel encapsulation;

[0112] Determine whether the tunnel encapsulation table entry corresponding to the encapsulation index has been unloaded before;

[0113] If not, uninstall the tunnel encapsulation table corresponding to the tunnel encapsulation table entries that were previously uninstalled.

[0114] If so, increase the reference count of tunnel encapsulation table entries that were not previously unloaded.

[0115] Optionally, the DPU is also specifically used for:

[0116] Edit the tunnel encapsulation content in the tunnel encapsulation table to the outer layer of the received first message, and modify the VNI of the outer tunnel message to the VNI in the corresponding action field.

[0117] Optionally, in generating the downlink tunnel encapsulation precise flow table and tunnel encapsulation table, the virtual switch is specifically used for:

[0118] Generate the precise flow table for the downlink tunnel encapsulation;

[0119] The tunnel encapsulation table is generated based on the encapsulation index of the downlink tunnel encapsulation precise flow table. The entries in the tunnel encapsulation table contain the tunnel headers that need to be encapsulated in the inner layer packets later.

[0120] Optionally, the processor 601 is further specifically used for:

[0121] Receive the second packet sent by the network side; match the flow table according to the second packet; if the hardware flow table is matched, obtain the second action field of the matched hardware flow table, the second action field includes: the second port number of the output port of the second packet, the second encapsulation operation, the second encapsulation index and the second VNI; obtain the corresponding tunnel encapsulation table according to the second encapsulation index and forward the second packet directly.

[0122] As can be seen, the DPU described in this embodiment includes a processor and a controller. The controller includes a virtual switch. The processor receives the first packet sent by the network side, which includes a first message. The processor matches the flow table according to the first message. If no hardware flow table is matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first message. The virtual switch edits and encapsulates the first message into a tunnel message, calculates the first port number of the outgoing port of the first message, and generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the message content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes a first port number, a first encapsulation action, a first encapsulation index, and a sub-tunnel entry. The first VNI extracted from the encapsulation table is written to 0 by the virtual switch in the tunnel encapsulation table within the tunnel. The processor unloads the tunnel encapsulation table and the downlink tunnel encapsulation precise flow table corresponding to the encapsulation index, and sends the first packet out to the port corresponding to the first port number. Since the VNI information is not placed in the tunnel encapsulation table, it will not cause an increase in hardware resource usage. In addition, after the first packet upcall, the virtual switch (OVS) sends the VNI to the hardware through the action field. After the hardware matches and hits the flow table, it can obtain the action to replace the VNI without causing additional hardware burden. That is, the VNI field in the tunnel encapsulation table within the tunnel is written to 0, thereby saving hardware resources of the tunnel encapsulation table.

[0123] It is understood that the functions of each program module of the DPU in this embodiment can be specifically implemented according to the methods in the above method embodiments. The specific implementation process can be referred to the relevant descriptions in the above method embodiments, which will not be repeated here.

[0124] This application also provides a computer storage medium storing a computer program for electronic data interchange, which causes a computer to perform some or all of the steps of any of the methods described in the above method embodiments, wherein the computer includes a DPU.

[0125] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the methods described in the above method embodiments. The computer program product may be a software installation package, and the computer may include a DPU.

[0126] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0127] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0128] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.

[0129] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0130] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0131] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0132] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0133] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for managing tunnel encapsulation table resources, characterized in that, Applied to a data processor (DPU), the DPU including a processor and a controller, the controller including a virtual switch, the method includes: The processor receives the first packet sent by the network side, the first packet including a first message; The processor matches the flow table according to the first packet; if the hardware flow table is not matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first packet. The virtual switch edits and encapsulates the first packet into a tunnel packet, calculates the first port number of the outgoing port of the first packet, and generates a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the packet content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes the first port number, the first encapsulation action, the first encapsulation index, and the first VNI extracted from the tunnel encapsulation table. The virtual switch writes 0 to the VNI field in the tunnel encapsulation table within the tunnel. The processor unloads the tunnel encapsulation table corresponding to the first encapsulation index and the downlink tunnel encapsulation precise flow table, and sends the first packet out of the outgoing port corresponding to the first port number; The unloading of the tunnel encapsulation table corresponding to the first encapsulation index and the downlink tunnel encapsulation precise flow table includes: Unload the precise flow table of the downlink tunnel encapsulation; Determine whether the tunnel encapsulation table entry corresponding to the first encapsulation index has been unloaded before; If not, uninstall the tunnel encapsulation table corresponding to the tunnel encapsulation table entries that were not previously uninstalled; If so, increase the reference count of previously unloaded tunnel encapsulation table entries.

2. The method according to claim 1, characterized in that, The method further includes: Edit the tunnel encapsulation content in the tunnel encapsulation table to the outer layer of the received first message, and modify the VNI of the outer tunnel message to the VNI in the corresponding action field.

3. The method according to claim 1, characterized in that, The generation of the downlink tunnel encapsulation precise flow table and tunnel encapsulation table includes: Generate the precise flow table for the downlink tunnel encapsulation; The tunnel encapsulation table is generated based on the encapsulation index of the downlink tunnel encapsulation precise flow table. The entries in the tunnel encapsulation table contain the tunnel headers that need to be encapsulated in the inner layer packets later.

4. The method according to claim 1, characterized in that, The method further includes: The processor receives a second message sent from the network side; The processor matches the flow table according to the second message; If a hardware flow table is hit, the processor obtains the second action field of the hit hardware flow table. The second action field includes: the second port number of the outgoing port of the second packet, the second encapsulation operation, the second encapsulation index, and the second VNI. Based on the second encapsulation index, the processor obtains the corresponding tunnel encapsulation table and forwards the second packet directly.

5. A data processor (DPU), characterized in that, The DPU includes a processor and a controller, wherein the controller includes a virtual switch. The processor is configured to receive a first packet sent by the network side, the first packet including a first message; The processor is further configured to match the flow table according to the first packet; if the flow table is not matched, the processor forwards the first packet to the virtual switch to perform software forwarding of the first packet. The virtual switch is used to edit and encapsulate the first packet into a tunnel packet, calculate the first port number of the outgoing port of the first packet, and generate a downlink tunnel encapsulation precise flow table and a tunnel encapsulation table. The tunnel encapsulation table is used to store the packet content to be encapsulated. The downlink tunnel encapsulation precise flow table includes a first action field, which includes the first port number, a first encapsulation action, a first encapsulation index, and a first VNI extracted from the tunnel encapsulation table. The virtual switch is also used to write 0 to the VNI field in the tunnel encapsulation table in the tunnel. The processor is further configured to unload the tunnel encapsulation table corresponding to the first encapsulation index and the downlink tunnel encapsulation precise flow table, and send the first packet out of the output port corresponding to the first port number; Specifically, regarding the unloading of the tunnel encapsulation table corresponding to the first encapsulation index and the downlink tunnel encapsulation precise flow table, the processor is configured to: Unload the precise flow table of the downlink tunnel encapsulation; Determine whether the tunnel encapsulation table entry corresponding to the first encapsulation index has been unloaded before; If not, uninstall the tunnel encapsulation table corresponding to the tunnel encapsulation table entries that were not previously uninstalled; If so, increase the reference count of previously unloaded tunnel encapsulation table entries.

6. The DPU according to claim 5, characterized in that, The processor is also specifically used for: Edit the tunnel encapsulation content in the tunnel encapsulation table to the outer layer of the received first message, and modify the VNI of the outer tunnel message to the VNI in the corresponding action field.

7. An electronic device, characterized in that, It includes a processor and a memory, the memory being used to store one or more programs and configured to be executed by the processor, the programs including instructions for performing the steps of the method as described in any one of claims 1-4.

8. A computer-readable storage medium, characterized in that, A computer program for storing electronic data interchange is provided, wherein the computer program causes a computer to perform the method as described in any one of claims 1-4.