Tunnel message encapsulation, decapsulation method, device and system

By separating and storing the endpoint information of local virtual extension LAN tunnels and matching the processing, the problem of inefficiency caused by information mixing in the prior art is solved, the search and packaging and decapsulation speed of network equipment is improved, and the system performance is improved .

CN118573516BActive Publication Date: 2024-12-06ZHUHAI XINGYUN ZHILIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411048152.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2024-12-06
Estimated Expiration
2044-08-01

AI Technical Summary

Technical Problem

In the prior art, local virtual extension LAN tunnel endpoint information and encapsulated information are mixed together, resulting in inconvenience in searching and use, affecting efficiency.

Method used

The local virtual extended LAN tunnel endpoint information and encapsulation information are stored in different tables respectively, and encapsulation and deencapsulation are performed by matching the original metadata and encapsulation table entries to improve search speed and efficiency.

Benefits of technology

It realizes the efficiency of rapid search and packaging and decapsulation, reduces resource waste and improves the performance of network equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118573516B_ABST
    Figure CN118573516B_ABST
Patent Text Reader

Abstract

The present application provides a method, device and system for encapsulating and decapsulating a tunnel message. The method includes: a network device extracts first original metadata from a first original message; when the first original metadata matches a first matching item in a first encapsulation table item, obtains first encapsulation information, encapsulates the first original message according to the first encapsulation information to obtain a first tunnel message, the first encapsulation information includes first local virtual extended local area network tunnel endpoint information and first encapsulation table information; the first local virtual extended local area network tunnel endpoint information in the first encapsulation information refers to the first local virtual extended local area network tunnel endpoint information stored in the first local virtual extended local area network tunnel endpoint information table item, the first encapsulation table information is stored in the first encapsulation table item, the first local virtual extended local area network tunnel endpoint information table item belongs to the local virtual extended local area network tunnel endpoint information table, and the first encapsulation table item belongs to the encapsulation table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a tunnel message encapsulation and decapsulation method, device and system. Background Art

[0002] To realize network virtualization in cloud computing data centers, the most basic technology is to isolate the physical network and the virtual network through tunnel technology, create multiple virtual networks based on the existing physical network, and realize the automation and intelligence of the data center. The principle of tunnel technology is to encapsulate the original layer 2 data frame of the virtual network and transmit it through the physical network. Without making any changes to the existing physical network, multiple virtual networks are created on the existing physical network through tunnel technology, realizing the automation and intelligence of the data center.

[0003] Currently, local virtual extended LAN tunnel endpoint information and encapsulation information are mixed together, which makes it very inconvenient to use. Summary of the invention

[0004] The present application provides a tunnel message encapsulation, decapsulation method, device and system, which can respectively set the local virtual extended local area network tunnel endpoint information and encapsulation information in different tables. Because the amount of local virtual extended local area network tunnel endpoint information is very small, the search speed is very fast, which is conducive to improving the search efficiency.

[0005] In a first aspect, a tunnel message encapsulation method is provided, comprising:

[0006] The network device extracts first original metadata from the first original message;

[0007] In the case where the first original metadata matches the first matching item in the first encapsulation table item, obtaining first encapsulation information, and encapsulating the first original message according to the first encapsulation information to obtain a first tunnel message, wherein the first encapsulation information includes first local virtual extended LAN tunnel endpoint information and first encapsulation table information;

[0008] Among them, the first local virtual extended LAN tunnel endpoint information in the first encapsulation information refers to the first local virtual extended LAN tunnel endpoint information stored in the first local virtual extended LAN tunnel endpoint information table item, the first encapsulation table information is stored in the first encapsulation table item, the first local virtual extended LAN tunnel endpoint information table item belongs to the local virtual extended LAN tunnel endpoint information table, the first encapsulation table item belongs to the encapsulation table, and the local virtual extended LAN tunnel endpoint information table is smaller than the encapsulation table.

[0009] In some possible designs, the method further includes:

[0010] Extracting second original metadata from the second original message;

[0011] In the case where the second original metadata matches the second matching item in the second encapsulation table item, obtaining second encapsulation information, and encapsulating the second original message according to the second encapsulation information to obtain a second tunnel message, wherein the second encapsulation information includes the first local virtual extended LAN tunnel endpoint information and the second encapsulation table information;

[0012] Among them, the first local virtual extended LAN tunnel endpoint information in the second encapsulation information refers to the first local virtual extended LAN tunnel endpoint information stored in the first local virtual extended LAN tunnel endpoint information table item, the second encapsulation table information is stored in the second encapsulation table item, and the second encapsulation table belongs to the encapsulation table.

[0013] In some possible designs, extracting third original metadata from the third original message;

[0014] In the case where the third original metadata matches the third matching item in the third encapsulation table item, obtaining third encapsulation information, and encapsulating the third original message according to the third encapsulation information to obtain a third encapsulated message, wherein the third encapsulation information includes the second local virtual extended LAN tunnel endpoint information and the third encapsulation table information;

[0015] The second local virtual extended LAN tunnel endpoint information refers to the second local virtual extended LAN tunnel endpoint information stored in the second local virtual extended LAN tunnel endpoint information table item, the second local virtual extended LAN tunnel endpoint information table item is stored in the local virtual extended LAN tunnel endpoint information table, the third encapsulation table information is stored in the third encapsulation table item, and the third encapsulation table item is stored in the encapsulation table.

[0016] In some possible designs, the first local virtual extended LAN tunnel endpoint information includes one or more of a first local virtual extended LAN tunnel endpoint source Internet Protocol address and a first local virtual extended LAN tunnel endpoint source media control address.

[0017] In some possible designs, the first encapsulation table information includes one or more of an encapsulation template, a remote virtual extended LAN tunnel endpoint destination Internet Protocol address, a remote virtual extended LAN tunnel endpoint destination media control address, an outer LAN address, and an inner LAN address.

[0018] In some possible designs, the first original metadata includes one or more of the source Internet Protocol address, destination Internet Protocol address, protocol type, source port number, and destination port number of the first original message.

[0019] In some possible designs, the number of entries in the local virtual extended LAN tunnel endpoint information table is in the order of dozens or several levels.

[0020] In a second aspect, a tunnel message decapsulation method is provided, comprising:

[0021] The network device extracts first tunnel metadata from the first tunnel message, wherein the first tunnel metadata includes first tunnel outer metadata and first tunnel inner metadata;

[0022] In a case where the first tunnel outer layer metadata matches a matching item of the first tunnel outer layer flow table entry, marking the first tunnel message with a tunnel message mark, wherein the tunnel message mark is used to indicate that the marked message is a tunnel message;

[0023] In a case where the first tunnel message is marked with a tunnel message tag and the first tunnel inner layer metadata matches a matching item of the first tunnel inner layer flow table item, decapsulating the first tunnel message to obtain a first original message;

[0024] Among them, the first tunnel outer laminar flow table entry belongs to the tunnel outer laminar flow table, the first tunnel inner laminar flow table entry belongs to the tunnel inner laminar flow table, and the tunnel outer laminar flow table is smaller than the tunnel inner laminar flow table.

[0025] In some possible designs, the method further includes:

[0026] Extracting second tunnel metadata from the second tunnel message, wherein the second tunnel metadata includes second tunnel outer metadata and second tunnel inner metadata;

[0027] In a case where the second tunnel outer layer metadata matches a matching item of the second tunnel outer layer flow table item, marking the second tunnel message with a tunnel message mark;

[0028] When the second tunnel message is marked with a tunnel message tag and the second tunnel inner layer metadata matches a matching item of the second tunnel inner layer flow table item, decapsulating the second tunnel message to obtain a second original message;

[0029] Among them, the second tunnel outer laminar flow table entry belongs to the tunnel outer laminar flow table, and the second tunnel inner laminar flow table entry belongs to the tunnel inner laminar flow table.

[0030] In some possible designs, the first tunnel outer metadata includes one or more of the tunnel type, the first local virtual extended LAN tunnel endpoint source Internet Protocol address, the first local virtual extended LAN tunnel endpoint source media control address outer LAN address and inner LAN address.

[0031] In some possible designs, the first tunnel inner layer metadata includes one or more of the source Internet Protocol address, destination Internet Protocol address, protocol type, source port number, and destination port number of the first original message.

[0032] In some possible designs, the action of matching the first tunnel outer layer metadata with the matching item of the first tunnel outer layer flow table entry is performed in the message inlet processing module of the network device, and the action of matching the first tunnel inner layer metadata with the matching item of the first tunnel inner layer flow table entry is performed in the message flow processing module of the network device;

[0033] Among them, the message flow processing module is used to perform the action of matching the first tunnel inner layer metadata with the matching items of the first tunnel inner layer flow table entry only when it is determined that the message entry processing module of the network device marks the first tunnel message with a tunnel message mark.

[0034] In some possible designs, the number of entries in the tunnel outer layer flow table is in the order of tens or several levels.

[0035] In a third aspect, a network device is provided, comprising a processor and a memory, wherein the memory is used to store instructions, and the processor obtains instructions from the memory to implement the method as described in any one of the first aspect or the second aspect.

[0036] In a fourth aspect, a network system is provided, including a software defined network and a plurality of network devices, wherein the network devices are the network devices as described in the third aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below.

[0038] Figure 1 A schematic diagram of a tunnel message system involved in this application;

[0039] Figure 2 It is a structural diagram of a network device provided by the present application;

[0040] Figure 3 It is a flow chart of a tunnel message encapsulation method provided by the present application;

[0041] Figure 4 It is a flowchart of a tunnel message decapsulation method provided by the present application;

[0042] Figure 5 It is a structural schematic diagram of a computing device provided by this application. DETAILED DESCRIPTION

[0043] The embodiments of the present invention are described below in conjunction with the accompanying drawings in the embodiments of the present invention. The terms used in the implementation mode of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.

[0044] Figure 1 Schematic diagram of a tunnel message system involved in this application. Figure 1 As shown, the network device A112 located in the network A110 sends a tunnel message to the network device B122 located in the network B120 through the tunnel 130. Here, the tunnel message is obtained by encapsulating the original message into a tunnel message based on the tunnel technology and is used to send the tunnel message through the tunnel. By using the tunnel technology, the physical network composed of physical devices and physical links can be isolated from the virtual network. Multiple virtual networks can be created on the basis of the physical network, which can solve the problem that private networks cannot communicate with each other through the public network or heterogeneous networks cannot communicate directly. One way to encapsulate tunnel messages is to use the Generic Routing Encapsulation (GRE) protocol, which is used to encapsulate a data packet using one routing protocol in a data packet of another protocol. For example, Figure 1 The network A110 and network B120 shown in the figure can use tunneling technology such as the general routing encapsulation protocol to add the physical network's message header to the original message of the network device A112 in the network A110, so that the traffic can be transmitted through the tunnel 130. After the network device B122 in the network B120 receives the message, it removes the physical network's message header and restores it to the original message. In cloud computing and data center networks, open source virtual switches (Open vSwitch, OVS) are generally used to provide data plane traffic forwarding for various virtualized devices and virtual functions. The virtual switch can support tunnel message encapsulation and tunnel message sending of the original message, so that without modifying the existing physical network, multiple virtual networks can be created and the general routing encapsulation protocol can be used to achieve automation and intelligence of the data center. Among them, the sending end, for example Figure 1 The network device A112 located in the network A110 shown in FIG. 1 performs tunnel encapsulation on the original message and then sends the tunnel message through the tunnel 130; the receiving end, for example Figure 1The network device B122 shown in FIG. 1 is located in the network B120. After receiving the message, it determines whether the message is a tunnel message. If it is a tunnel message, it can perform tunnel decapsulation through the corresponding tunnel port to restore the original message.

[0045] See also Figure 2 , Figure 2 It is a structural diagram of a network device provided by this application. Figure 2 The network device may be Figure 1 The network device A112 or the network device B122 in the tunnel message system shown. Figure 2 As shown, the network device of the present application includes a processor 11 and offloading hardware 12 .

[0046] The processor 11 is a computing core and a control core, capable of handling complex situations. The processor 11 may be a very large scale integrated circuit. An operating system and other software programs are installed in the processor 11, so that the processor 11 can access the memory and various peripheral component interconnect express (PCIe) devices. The processor 11 can quickly access the memory through the on-chip bus. The processor 11 may include one or more processor cores. In one implementation, the processor 11 may be a multi-core chip, that is, a chip containing multiple processing cores. In another implementation, the processor 11 may include one or more processor cores, which may be a chip with one processing core.

[0047] The processor 11 may run an open source virtual switch (Open vSwitch, OVS) and a data plane development kit (Data Plane Development Kit, DPDK).

[0048] OVS is an open source virtual switch software that implements a flexible, programmable and scalable switch platform. It is used to communicate with the Software Defined Networking (SDN) controller through the OpenFlow protocol, receive the flow table sent by the SDN controller, and implement traffic forwarding and routing according to the flow table. OVS supports packet switching and routing in Layer 2 and Layer 3 networks, so OVS supports the processing of Ethernet data frames and data packets, etc. OVS can run on physical servers, virtual machines, containers, cloud platforms, and bare metal servers. OVS can also be used in combination with physical switches, etc.

[0049] DPDK's lightweight library functions use a very effective memory processing mechanism, which uses a ring buffer to transmit packets back and forth between the physical network card and the virtual switch using DPDK, thereby improving the overall performance of the system. OVS lacks optimization for the processing of high-speed packets, which results in the use of processors in many steps of the packet processing process. Since the processor needs to handle multiple tasks, its availability (especially when overloaded) will have performance bottlenecks. In order to reduce the number of processor interrupts required for packet reading, DPDK uses a periodic polling mechanism to periodically poll new packets. If the packet rate drops to a very low value, it can be switched to interrupt mode instead of periodic polling mode. Through effective cache management, optimized minimum number of CPU interrupts, and other enhanced features, DPDK enables virtual switches to achieve near-native performance.

[0050] The offloading hardware 12 may be an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a smart network card, an acceleration card, a data processing unit (DPU), and the like.

[0051] when Figure 2 The network devices in Figure 1 When the network device A112 is in Figure 2 The offload hardware in the tunnel packet encapsulation is implemented; when Figure 2 The network devices in Figure 1 When the network device B122 is in Figure 2 The offload hardware in the tunnel implements the decapsulation of tunnel messages.

[0052] like Figure 3 As shown, the offloading hardware 12 includes a message parsing module (PARSE), a message inlet processing module (IPRO), a message flow processing module (PP) and a data packet encapsulation module (PED). Among them, the message parsing module, the message inlet processing module, the message flow processing module and the data packet encapsulation module can all be implemented by software, or can be implemented by hardware. Exemplarily, the implementation method of the message parsing module is introduced below by taking the message parsing module as an example. Similarly, the implementation method of the message inlet processing module, the message flow processing module and the data packet encapsulation module can refer to the implementation method of the message parsing module.

[0053] As an example of a software functional unit, a packet parsing module may include code running on a network device. A packet parsing module is an independent component in a software system. It usually contains a set of related functions or data and can be developed, tested, and deployed separately. Through modular design, modules can be reused in different software systems to improve development efficiency. Modular design makes software maintenance easier because modifying one module usually does not affect other modules. In addition, modular design makes software systems easier to expand because new modules can be easily integrated into existing systems.

[0054] See also Figure 3 , Figure 3 FIG. 1 is a flow chart of a tunnel message encapsulation method provided by the present application. Figure 3 As shown, the tunnel message encapsulation method of the present application includes:

[0055] S101: A message parsing module in offloading hardware of a network device extracts first original metadata from a first original message.

[0056] The first original message includes a first original message header and a first original load. The first original message header may include one or more of a source network protocol (IP) address field, a destination IP address field, a protocol type field, a source port number field, and a destination port number field. Among them, the source IP address field is used to carry the source IP address of the first original message. The protocol type field is used to carry the type of protocol used by the first original message. The source port number field is used to carry the source port number of the first original message. The destination port number field is used to carry the destination port number of the first original message. The first original load is used to carry user information and other data to be transmitted. It can be understood that in addition to the above fields, the first original message header may also include more fields, such as version, message header length, lifetime, etc., which are not specifically limited here.

[0057] The message parsing module in the network device can extract one or more of the source IP address, destination IP address, protocol type, source port number, destination port number, etc. from the fields of the message header of the first original message as the first original metadata.

[0058] S102: The message traffic processing module in the offloading hardware of the network device determines whether the first original metadata matches the first matching item in the first encapsulation table item.

[0059] The first encapsulation table item belongs to one of the table items in the encapsulation table. The encapsulation table may include one or more encapsulation table items, and the encapsulation table items may include matching items and encapsulation information items. Among them, the matching items are used to store matching information. The matching information may include one or more of the source IP address, the destination IP address, the protocol type, the source port number, the destination port number, etc. The encapsulation information item is used to store the encapsulation information. The encapsulation information may include local virtual extended LAN tunnel endpoint information and encapsulation table information. The local virtual extended LAN tunnel endpoint information includes one or more of the local virtual extended LAN tunnel endpoint source Internet Protocol address and the local virtual extended LAN tunnel endpoint source media control address. The encapsulation table information includes one or more of the encapsulation template, the remote virtual extended LAN tunnel endpoint destination Internet Protocol address, the remote virtual extended LAN tunnel endpoint destination media control address, the outer LAN address, and the inner LAN address. Compared with the encapsulation table information, the number of local virtual extended LAN tunnel endpoint source Internet Protocol addresses and local virtual extended LAN tunnel endpoint source media control addresses in the local virtual extended LAN tunnel endpoint information is very small. For example, the number level in the encapsulation table information can be tens of thousands, but the number level of the local virtual extended LAN tunnel endpoint information can be tens of levels or several levels. Therefore, the local virtual extended LAN tunnel endpoint information can be stored separately in the local virtual extended LAN tunnel endpoint information table, and the encapsulation table information can be stored in the encapsulation table. Compared with the prior art, in which the local virtual extended LAN tunnel endpoint information and the encapsulation table information are mixed into the same table, the search efficiency will be higher. Moreover, after the local virtual extended LAN tunnel endpoint information is stored separately, when different original messages are encapsulated, if the local virtual extended LAN tunnel endpoint information is the same, then it is only necessary to refer to the local virtual extended LAN tunnel endpoint information in the same local virtual extended LAN tunnel endpoint information table item, and it is not necessary to re-copy a copy for each original message, resulting in a great waste of resources of the unloading hardware. The following will describe the local virtual extended LAN tunnel endpoint information table and the encapsulation table in conjunction with specific examples. Table 1 is the local virtual extended LAN tunnel endpoint information table, Table 2 is the encapsulation table,

[0060] Table 1 Local virtual extended LAN tunnel endpoint information table

[0061]

[0062] In the example shown in Table 1, only three local virtual extended LAN tunnel endpoint information are illustrated. In actual applications, more local virtual extended LAN tunnel endpoint information is included, which is not specifically limited here.

[0063] Table 2 Packaging table

[0064]

[0065] In the example shown in Table 2, only three packaging tables are illustrated. In actual applications, more packaging tables are included, which are not specifically limited here.

[0066] The encapsulation template includes one or more of an index, a type, a format, and a header length. The index is used to facilitate the search for the encapsulation template. The type is used to indicate the encapsulation into any one of Network Virtualization using Generic Routing Encapsulation (NVGRE), Virtual Extensible LAN (VXLAN), and Generic Network Virtualization Encapsulation (Geneve). The format is used to indicate the format of the encapsulation. The header length is used to indicate the length of the encapsulation header. The encapsulation template may include one or more of the 15 templates shown in Table 3:

[0067] Table 3 Package template

[0068]

[0069] Since the first encapsulation table item belongs to the table item in the encapsulation table, the first encapsulation table item includes the first matching item and the first encapsulation information item. Among them, the first matching item includes one or more of the first source Internet Protocol address, the first destination Internet Protocol address, the first protocol type, the first source port number, and the first destination port number. The first encapsulation information item includes the first local virtual extended LAN tunnel endpoint information and the first encapsulation table information. The first local virtual extended LAN tunnel endpoint information includes one or more of the first local virtual extended LAN tunnel endpoint source Internet Protocol address and the first local virtual extended LAN tunnel endpoint source media control address. The first encapsulation table information includes one or more of the first encapsulation template, the first remote virtual extended LAN tunnel endpoint destination Internet Protocol address, the first remote virtual extended LAN tunnel endpoint destination media control address, the first outer LAN address, and the first inner LAN address.

[0070] If the first original metadata and the first matching item in the first encapsulation table item match, the process proceeds to step S103 ; if the first original metadata and the first matching item in the first encapsulation table item do not match, the process does not proceed to step S103 .

[0071] S103: The data packet encapsulation module in the offloading hardware of the network device obtains first encapsulation information, and encapsulates the first original message according to the first encapsulation information to obtain a first tunnel message.

[0072] After determining the first encapsulation table entry, an encapsulation template can be determined from the first encapsulation table entry, and then, relevant information can be obtained from the first encapsulation table entry according to the encapsulation template, and the first original message can be encapsulated with the relevant information according to the encapsulation template to obtain the first tunnel message. For example, when the encapsulation template is determined to be an encapsulation module with an index of 1, the first original message will be encapsulated in the format of Mac+etype+ipv4+nvgre to obtain the first tunnel message.

[0073] S104: The message parsing module in the offloading hardware of the network device extracts the second original metadata from the second original message.

[0074] The second original message includes a second original message header and a second original load. The second original message header may include one or more of a source network protocol (IP) address field, a destination IP address field, a protocol type field, a source port number field, and a destination port number field. Among them, the source IP address field is used to carry the source IP address of the second original message. The protocol type field is used to carry the type of protocol used by the second original message. The source port number field is used to carry the source port number of the second original message. The destination port number field is used to carry the destination port number of the second original message. The second original load is used to carry user information and other data to be transmitted. It can be understood that in addition to the above fields, the second original message header may also include more fields, such as version, message header length, lifetime, etc., which are not specifically limited here.

[0075] The message parsing module in the network device can extract one or more of the source IP address, destination IP address, protocol type, source port number, destination port number, etc. from the fields of the message header of the second original message as the second original metadata.

[0076] S105: The message flow processing module in the offloading hardware of the network device determines whether the second original metadata matches the second matching item in the second encapsulation table item.

[0077] The second encapsulation table item belongs to another table item in the encapsulation table. Therefore, the second encapsulation table item includes a second matching item and a second encapsulation information item. Among them, the second matching item includes one or more of the second source Internet Protocol address, the second destination Internet Protocol address, the second protocol type, the second source port number, and the second destination port number. The second encapsulation information item includes the first local virtual extended LAN tunnel endpoint information and the second encapsulation table information. The first local virtual extended LAN tunnel endpoint information includes one or more of the first local virtual extended LAN tunnel endpoint source Internet Protocol address and the first local virtual extended LAN tunnel endpoint source media control address. The second encapsulation table information includes one or more of the second encapsulation template, the second remote virtual extended LAN tunnel endpoint destination Internet Protocol address, the second remote virtual extended LAN tunnel endpoint destination media control address, the second outer LAN address, and the second inner LAN address.

[0078] If the second original metadata and the second matching item in the second encapsulation table item match, the process goes to step S106 ; if the second original metadata and the second matching item in the second encapsulation table item do not match, the process does not go to step S106 .

[0079] S106: The data packet encapsulation module in the offloading hardware of the network device obtains second encapsulation information, and encapsulates the second original message according to the second encapsulation information to obtain a second tunnel message.

[0080] After determining the second encapsulation table entry, the encapsulation template can be determined from the second encapsulation table entry, and then, the relevant information can be obtained from the second encapsulation table entry according to the encapsulation template, and the relevant information can be encapsulated on the second original message according to the encapsulation template to obtain the second tunnel message. For example, when the encapsulation template is determined to be an encapsulation module with an index of 2, the second original message will be encapsulated in the format of Mac+vlan+etype+ipv4+nvgre to obtain the second tunnel message.

[0081] S107: The message parsing module in the offloading hardware of the network device extracts the third original metadata from the third original message.

[0082] The third original message includes a third original message header and a third original load. The third original message header may include one or more of a source network protocol (IP) address field, a destination IP address field, a protocol type field, a source port number field, and a destination port number field. Among them, the source IP address field is used to carry the source IP address of the third original message. The protocol type field is used to carry the type of protocol used by the third original message. The source port number field is used to carry the source port number of the third original message. The destination port number field is used to carry the destination port number of the third original message. The third original load is used to carry user information and other data to be transmitted. It can be understood that in addition to the above fields, the third original message header may also include more fields, such as version, message header length, lifetime, etc., which are not specifically limited here.

[0083] The message parsing module in the network device can extract one or more of the source IP address, destination IP address, protocol type, source port number, destination port number, etc. from the fields of the message header of the third original message as the third original metadata.

[0084] S108: The message flow processing module in the offloading hardware of the network device determines whether the third original metadata matches the third matching item in the third encapsulation table item.

[0085] The third encapsulation table item belongs to another table item in the encapsulation table. Therefore, the third encapsulation table item includes a third matching item and a third encapsulation information item. Among them, the third matching item includes one or more of a third source Internet Protocol address, a third destination Internet Protocol address, a third protocol type, a third source port number, and a third destination port number. The third encapsulation information item includes the second local virtual extended LAN tunnel endpoint information and the third encapsulation table information. The second local virtual extended LAN tunnel endpoint information includes one or more of the second local virtual extended LAN tunnel endpoint source Internet Protocol address and the second local virtual extended LAN tunnel endpoint source media control address. The third encapsulation table information includes one or more of the third encapsulation template, the third remote virtual extended LAN tunnel endpoint destination Internet Protocol address, the third remote virtual extended LAN tunnel endpoint destination media control address, the third outer LAN address, and the third inner LAN address.

[0086] If the third original metadata and the third matching item in the third encapsulation table item match, the process proceeds to step S109 ; if the third original metadata and the third matching item in the third encapsulation table item do not match, the process does not proceed to step S109 .

[0087] S109: The data packet encapsulation module in the offloading hardware of the network device obtains the third encapsulation information, and encapsulates the third original message according to the third encapsulation information to obtain a third tunnel message.

[0088] After determining the third encapsulation table entry, the encapsulation template can be determined from the third encapsulation table entry, and then, the relevant information can be obtained from the third encapsulation table entry according to the encapsulation template, and the relevant information can be encapsulated on the third original message according to the encapsulation template to obtain the third tunnel message. For example, when the encapsulation template is determined to be an encapsulation module with an index of 3, the third original message will be encapsulated in the format of Mac+vlan+vlan+etype+ipv4+nvgre to obtain the third tunnel message.

[0089] See also Figure 4 , Figure 4 FIG. 1 is a flow chart of a tunnel message decapsulation method provided by the present application. Figure 4 As shown, the tunnel message decapsulation method of the present application includes:

[0090] S201: A message parsing module in the offloading hardware of a network device extracts first tunnel metadata from a first tunnel message.

[0091] The first tunnel metadata includes the first tunnel outer metadata and the first tunnel inner metadata. The first tunnel outer metadata includes one or more of the first tunnel type, the first local virtual extended LAN tunnel endpoint source Internet Protocol address, the first local virtual extended LAN tunnel endpoint source media control address outer LAN address and inner LAN address. The first tunnel inner metadata includes one or more of the first original message's source Internet Protocol address, destination Internet Protocol address, protocol type, source port number, and destination port number.

[0092] S202: The message inlet processing module in the offloading hardware of the network device matches the first tunnel outer layer metadata with the matching item of the first tunnel outer layer flow table item.

[0093] The first tunnel outer layer flow table includes a first outer layer matching item and a first outer layer action item. The first tunnel outer layer flow table item belongs to the tunnel outer layer flow table. Among them, the first outer layer matching item includes a first tunnel type field, a first local virtual extended LAN tunnel endpoint source Internet Protocol address field, a first local virtual extended LAN tunnel endpoint source media control address field, a first outer layer LAN information and an inner layer LAN information field. Optionally, it may also include a first valid field. Among them, the first tunnel type field is used to indicate that the tunnel message is any one of VXLAN, NVGRE and GENEVE. The first outer layer action item is used to indicate that the first tunnel message is marked with a tunnel message mark.

[0094] When the first tunnel outer metadata and the first outer matching item of the first tunnel outer flow entry match, step S203 is entered; when the first tunnel outer metadata and the first outer matching item of the first tunnel outer flow entry do not match, step S203 is not entered.

[0095] S203: The message inlet processing module in the offloading hardware of the network device adds a tunnel message mark to the first tunnel message.

[0096] S204: The message flow processing module in the unloading hardware of the network device determines whether the first tunnel message is marked with a tunnel message mark. If the first tunnel message is marked with a tunnel message mark, the process goes to step S205.

[0097] S205: The message flow processing module in the offloading hardware of the network device matches the first tunnel inner layer metadata with the matching item of the first tunnel inner layer flow table item.

[0098] The first tunnel inner layer flow table includes a first inner layer matching item and a first inner layer action item. The first tunnel inner layer flow table item belongs to the tunnel inner layer flow table. Among them, the first inner layer matching item includes one or more of a first source Internet Protocol address, a first destination Internet Protocol address, a first protocol type, a first source port number, and a first destination port number. The first inner layer action item is used to indicate that the first tunnel message is decapsulated to obtain a first original message.

[0099] When the first tunnel inner layer metadata and the first inner layer matching item of the first tunnel inner layer flow table entry match, step S206 is entered; when the first tunnel inner layer metadata and the first inner layer matching item of the first tunnel inner layer flow table entry do not match, step S206 is not entered.

[0100] Compared with the prior art, in which the information in the tunnel outer laminar flow table and the information in the tunnel inner laminar flow table are mixed into the same table, the number of tunnel outer laminar flow tables is relatively small, and the number of table items in the tunnel outer laminar flow table is in the order of tens or several levels, while the number of tunnel inner laminar flow tables is relatively large, and the number of table items in the tunnel inner laminar flow table is in the tens of thousands. By carrying this information in the tunnel outer laminar flow table and the tunnel inner laminar flow table respectively, the search efficiency will be higher.

[0101] S206: The data packet encapsulation module in the offloading hardware of the network device decapsulates the first tunnel message to obtain a first original message.

[0102] S207: The message parsing module in the offloading hardware of the network device extracts the second tunnel metadata from the second tunnel message.

[0103] The second tunnel metadata includes the second tunnel outer metadata and the second tunnel inner metadata. The second tunnel outer metadata includes one or more of the second tunnel type, the second local virtual extended LAN tunnel endpoint source Internet Protocol address, the second local virtual extended LAN tunnel endpoint source media control address outer LAN address and inner LAN address. The second tunnel inner metadata includes one or more of the source Internet Protocol address, destination Internet Protocol address, protocol type, source port number and destination port number of the first original message.

[0104] S208: The message inlet processing module in the offloading hardware of the network device matches the second tunnel outer layer metadata with the matching item of the second tunnel outer layer flow table item.

[0105] The second tunnel outer layer flow table includes a second outer layer matching item and a second outer layer action item. The second tunnel outer layer flow table item belongs to the tunnel outer layer flow table. Among them, the second outer layer matching item includes a second tunnel type field, a second local virtual extended LAN tunnel endpoint source Internet Protocol address field, a second local virtual extended LAN tunnel endpoint source media control address field, a second outer layer LAN information and an inner layer LAN information field. Optionally, a second valid field may also be included. Among them, the second tunnel type field is used to indicate that the tunnel message is any one of VXLAN, NVGRE and GENEVE. The second outer layer action item is used to indicate that the second tunnel message is marked with a tunnel message mark.

[0106] When the second tunnel outer metadata and the second outer matching item of the second tunnel outer flow entry match, the process goes to step S209 ; when the second tunnel outer metadata and the second outer matching item of the second tunnel outer flow entry do not match, the process does not go to step S209 .

[0107] S209: The message inlet processing module in the offloading hardware of the network device adds a tunnel message mark to the second tunnel message.

[0108] S210: The message flow processing module in the unloading hardware of the network device determines whether the second tunnel message is marked with a tunnel message mark. If the second tunnel message is marked with a tunnel message mark, the process goes to step S211.

[0109] S211: The message flow processing module in the offloading hardware of the network device matches the second tunnel inner layer metadata with the matching item of the second tunnel inner layer flow table item.

[0110] The second tunnel inner layer flow table includes a second inner layer matching item and a second inner layer action item. The second tunnel inner layer flow table item belongs to the tunnel inner layer flow table. Among them, the second inner layer matching item includes one or more of a second source Internet Protocol address, a second destination Internet Protocol address, a second protocol type, a second source port number, and a second destination port number. The second inner layer action item is used to indicate that the second tunnel message is decapsulated to obtain a second original message.

[0111] When the second tunnel inner layer metadata and the second inner layer matching item of the second tunnel inner layer flow table entry match, the process goes to step S212; when the second tunnel inner layer metadata and the second inner layer matching item of the second tunnel inner layer flow table entry do not match, the process does not go to step S212.

[0112] S212: The data packet encapsulation module in the offloading hardware of the network device decapsulates the second tunnel message to obtain a second original message.

[0113] See also Figure 5 , Figure 5 4 is a schematic diagram of a computing device provided by the present application. The computing device 400 includes: one or more processing units 410 , a communication interface 420 and a memory 430 .

[0114] The processing unit 410, the communication interface 420 and the memory 430 are interconnected via a bus 440. Optionally, the computing device 400 may also include an input / output interface 450, which is connected to an input / output device for receiving parameters set by a user, etc. The computing device 400 can be used to implement part or all of the functions of the device embodiment or system embodiment in the above-mentioned embodiment of the present application; the processing unit 410 can also be used to implement part or all of the operation steps of the method embodiment in the above-mentioned embodiment of the present application. For example, the specific implementation of the various operations performed by the computing device 400 can refer to the specific details in the above-mentioned embodiment, such as the processing unit 410 is used to perform part or all of the steps in the above-mentioned method embodiment or part or all of the operations in the above-mentioned method embodiment. For another example, in the embodiment of the present application, the computing device 400 can be used to implement part or all of the functions of one or more components in the above-mentioned device embodiment, and the communication interface 420 can be specifically used for the communication functions necessary to implement the functions of these devices and components, and the processing unit 410 can be specifically used for the processing functions necessary to implement the functions of these devices and components, etc.

[0115] Figure 5The computing device 400 may include one or more processing units 410, and the multiple processing units 410 may provide processing capabilities in a coordinated manner in a parallel connection manner, a serial connection manner, a serial-parallel connection manner, or any connection manner, or the multiple processing units 410 may constitute a processor sequence or a processor array, or the multiple processing units 410 may be divided into a main processor and an auxiliary processor, or the multiple processing units 410 may have different architectures such as a heterogeneous computing architecture. In addition, Figure 5 The computing device 400 shown in the figure, and the related structural description and functional description are exemplary and non-limiting. In some exemplary embodiments, the computing device 400 may include Figure 5 More or fewer components may be shown, or some components may be combined or separated, or may have a different arrangement of components.

[0116] The processing unit 410 may have a variety of specific implementation forms. For example, the processing unit 410 may include a central processing unit (CPU), a graphic processing unit (GPU), a neural-network processing unit (NPU), a tensor processing unit (TPU) or a data processing unit (DPU), etc., and the embodiment of the present application does not specifically limit it. The processing unit 410 may also be a single-core processor or a multi-core processor. The processing unit 410 may be a combination of a CPU and a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The processing unit 410 may also be implemented using a logic device with built-in processing logic alone, such as an FPGA or a digital signal processor (DSP). The communication interface 420 may be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface may be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface may be a cellular network interface or a wireless local area network interface, etc.

[0117] The memory 430 may be a non-volatile memory, such as a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The memory 430 may also be a volatile memory, which may be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous connection dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). The memory 430 may also be used to store program codes and data, so that the processing unit 410 calls the program codes stored in the memory 430 to execute some or all of the operation steps in the above method embodiment, or to execute the corresponding functions in the above device embodiment. Figure 5 Show more or fewer components, or have different component configurations.

[0118] The bus 440 may be a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 440 may be divided into an address bus, a data bus, a control bus, etc. In addition to the data bus, the bus 440 may also include a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0119] The present application also provides a system, which includes multiple computing devices, and the structure of each computing device can refer to the structure of the computing device described above. The functions or operations that can be implemented by the system can refer to the specific implementation steps in the above method embodiment and / or the specific functions described in the above device embodiment, which will not be repeated here.

[0120] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one network site, computer, server or data center to another network site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer, or it can be a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape, etc.), an optical medium (e.g., a DVD, etc.), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0121] In the above embodiments, the description of each embodiment has different emphases. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

Claims

1. A tunnel message encapsulation method, It is characterized in that include: The network device extracts first original metadata from the first original message; In the case where the first original metadata matches the first matching item in the first encapsulation table item, obtaining first encapsulation information, and encapsulating the first original message according to the first encapsulation information to obtain a first tunnel message, wherein the first encapsulation information includes first local virtual extended LAN tunnel endpoint information and first encapsulation table information; Among them, the first local virtual extended LAN tunnel endpoint information in the first encapsulation information refers to the first local virtual extended LAN tunnel endpoint information stored in the first local virtual extended LAN tunnel endpoint information table item, the first encapsulation table information is stored in the first encapsulation table item, the first local virtual extended LAN tunnel endpoint information table item belongs to the local virtual extended LAN tunnel endpoint information table, the first encapsulation table item belongs to the encapsulation table, and the local virtual extended LAN tunnel endpoint information table is smaller than the encapsulation table.

2. The packaging method according to claim 1, It is characterized in that The packaging method further comprises: Extracting second original metadata from the second original message; In the case where the second original metadata matches the second matching item in the second encapsulation table item, obtaining second encapsulation information, and encapsulating the second original message according to the second encapsulation information to obtain a second tunnel message, wherein the second encapsulation information includes the first local virtual extended LAN tunnel endpoint information and the second encapsulation table information; Among them, the first local virtual extended LAN tunnel endpoint information in the second encapsulation information refers to the first local virtual extended LAN tunnel endpoint information stored in the first local virtual extended LAN tunnel endpoint information table item, the second encapsulation table information is stored in the second encapsulation table item, and the second encapsulation table belongs to the encapsulation table.

3. The packaging method according to claim 2, It is characterized in that extracting third original metadata from the third original message; In the case where the third original metadata matches the third matching item in the third encapsulation table item, obtaining third encapsulation information, and encapsulating the third original message according to the third encapsulation information to obtain a third encapsulated message, wherein the third encapsulation information includes the second local virtual extended LAN tunnel endpoint information and the third encapsulation table information; The second local virtual extended LAN tunnel endpoint information refers to the second local virtual extended LAN tunnel endpoint information stored in the second local virtual extended LAN tunnel endpoint information table item, the second local virtual extended LAN tunnel endpoint information table item is stored in the local virtual extended LAN tunnel endpoint information table, the third encapsulation table information is stored in the third encapsulation table item, and the third encapsulation table item is stored in the encapsulation table.

4. The packaging method according to claim 1, It is characterized in that The first local virtual extended LAN tunnel endpoint information includes one or more of a first local virtual extended LAN tunnel endpoint source Internet Protocol address and a first local virtual extended LAN tunnel endpoint source media control address.

5. The packaging method according to claim 4, It is characterized in that The first encapsulation table information includes one or more of an encapsulation template, a remote virtual extended LAN tunnel endpoint destination Internet Protocol address, a remote virtual extended LAN tunnel endpoint destination media control address, an outer LAN address, and an inner LAN address.

6. The packaging method according to any one of claims 1 to 5, It is characterized in that The first original metadata includes one or more of a source Internet Protocol address, a destination Internet Protocol address, a protocol type, a source port number, and a destination port number of the first original message.

7. The packaging method according to any one of claims 1 to 5, It is characterized in that The number of entries in the local virtual extended LAN tunnel endpoint information table is in the order of dozens or several levels.

8. A tunnel message decapsulation method, It is characterized in that include: The network device extracts first tunnel metadata from the first tunnel message, wherein the first tunnel metadata includes first tunnel outer metadata and first tunnel inner metadata; In a case where the first tunnel outer layer metadata matches a matching item of the first tunnel outer layer flow table entry, marking the first tunnel message with a tunnel message mark, wherein the tunnel message mark is used to indicate that the marked message is a tunnel message; In a case where the first tunnel message is marked with a tunnel message tag and the first tunnel inner layer metadata matches a matching item of the first tunnel inner layer flow table item, decapsulating the first tunnel message to obtain a first original message; Among them, the first tunnel outer laminar flow table entry belongs to the tunnel outer laminar flow table, the first tunnel inner laminar flow table entry belongs to the tunnel inner laminar flow table, and the tunnel outer laminar flow table is smaller than the tunnel inner laminar flow table.

9. The decapsulation method according to claim 8, It is characterized in that The decapsulation method further comprises: Extracting second tunnel metadata from the second tunnel message, wherein the second tunnel metadata includes second tunnel outer metadata and second tunnel inner metadata; In a case where the second tunnel outer layer metadata matches a matching item of the second tunnel outer layer flow table item, marking the second tunnel message with a tunnel message mark; When the second tunnel message is marked with a tunnel message tag and the second tunnel inner layer metadata matches a matching item of the second tunnel inner layer flow table item, decapsulating the second tunnel message to obtain a second original message; Among them, the second tunnel outer laminar flow table entry belongs to the tunnel outer laminar flow table, and the second tunnel inner laminar flow table entry belongs to the tunnel inner laminar flow table.

10. The decapsulation method according to claim 9, It is characterized in that The first tunnel outer metadata includes one or more of the tunnel type, the first local virtual extended LAN tunnel endpoint source Internet Protocol address, the first local virtual extended LAN tunnel endpoint source media control address outer LAN address and inner LAN address.

11. The decapsulation method according to claim 10, It is characterized in that The first tunnel inner layer metadata includes one or more of the source Internet Protocol address, destination Internet Protocol address, protocol type, source port number, and destination port number of the first original message.

12. The decapsulation method according to any one of claims 8 to 11, It is characterized in that The action of matching the first tunnel outer layer metadata with the matching item of the first tunnel outer layer flow table entry is performed in the message inlet processing module of the network device, and the action of matching the first tunnel inner layer metadata with the matching item of the first tunnel inner layer flow table entry is performed in the message flow processing module of the network device; Among them, the message flow processing module is used to perform the action of matching the first tunnel inner layer metadata with the matching items of the first tunnel inner layer flow table entry only when it is determined that the message entry processing module of the network device marks the first tunnel message with a tunnel message mark.

13. The decapsulation method according to any one of claims 8 to 11, It is characterized in that The number of entries in the tunnel outer layer flow table is in the order of dozens or several levels.

14. A network device, It is characterized in that The method comprises a processor and a memory, wherein the memory is used to store instructions, and the processor obtains instructions from the memory to implement the method according to any one of claims 1 to 13.

15. A network system, It is characterized in that It comprises a software defined network and a plurality of network devices, wherein the network device is the network device as claimed in claim 14.