Route matching method, device, equipment, network card and computer program product

By using link data structures as the overall node in the dictionary tree for matching, the problem of low routing matching performance in the prior art is solved, and matching efficiency and accuracy are improved.

CN119299368BActive Publication Date: 2025-03-11ALIBABA CLOUD COMPUTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411825159.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-03-11
Estimated Expiration
2044-12-11

AI Technical Summary

Technical Problem

In the prior art, when using a dictionary tree for routing matching, the number of node queries is large, resulting in a degradation of routing matching performance.

Method used

By introducing a linked data structure into the dictionary tree, data matching operations are performed as an overall node, thereby reducing the number of query nodes and query times.

Benefits of technology

The efficiency of routing matching operations and the quality and efficiency of dictionary tree access are improved, and the accuracy and reliability of routing forwarding rules are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119299368B_ABST
    Figure CN119299368B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention relate to the field of network technology, and specifically provide a routing matching method, device, equipment, network card and computer program product. The routing matching method includes: obtaining data to be processed; determining a dictionary tree for matching the data to be processed, the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least one link node, and the data corresponding to the link data structure includes at least: the query address of the end link node and the address data corresponding to the link data structure; querying the dictionary tree to obtain the target matching data corresponding to the data to be processed, and determining the routing forwarding rules corresponding to the data to be processed based on the target matching data. In this embodiment, when the dictionary tree is used to perform a matching operation on the data to be processed, the link data structure in the dictionary tree is matched as a whole node, which effectively improves the efficiency of accessing the dictionary tree.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network technology, and in particular to a routing matching method, device, equipment, network card and computer program product. Background Art

[0002] Route matching is a key concept in network communication, which refers to deciding how a data packet should be forwarded to its destination based on specific rules or policies. Currently, route matching operations are often implemented through dictionary trees, such as Figure 1 As shown in the figure, the highest node in the dictionary tree is the starting position (corresponding to rule *), and "*" is used to indicate that the current node has no configured rules. Then, when the first bit in the data to be matched is 0, it jumps to the node on the lower left (the node has the corresponding rule a, 0*), and when the first bit in the data to be matched is 1, it jumps to the node on the lower right (the node has the corresponding rule d, 1*), and then, according to the subsequent bits in the data to be matched, a longer rule is matched, and so on. The last node can be queried according to each bit in the data to be matched, and then the matching rule is stopped and returned.

[0003] However, the above process of using the dictionary tree to perform route matching operations has the following defects: each node in the dictionary tree needs to perform a rule query operation, which results in a large number of node queries in the dictionary tree, which may lead to a decrease in route matching performance. Summary of the invention

[0004] The embodiments of the present invention provide a route matching method, device, equipment, network card and computer program product, which can improve the quality and efficiency of route matching.

[0005] In a first aspect, an embodiment of the present invention provides a route matching method, including:

[0006] Get the data to be processed;

[0007] Determine a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least one link node, and the data corresponding to the link data structure at least includes: a query address of an end link node and address data corresponding to the link data structure;

[0008] The dictionary tree is queried to obtain target matching data corresponding to the data to be processed, and a routing forwarding rule corresponding to the data to be processed is determined based on the target matching data.

[0009] In a second aspect, an embodiment of the present invention provides a routing matching device, including:

[0010] A first acquisition module, used to acquire data to be processed;

[0011] A first determination module is used to determine a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least two link nodes, and the data corresponding to the link data structure at least includes: a query address of an end link node and address data corresponding to the link data structure;

[0012] The first processing module is used to query the dictionary tree to obtain target matching data corresponding to the data to be processed, and determine a routing forwarding rule corresponding to the data to be processed based on the target matching data.

[0013] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the routing matching method in the above-mentioned first aspect.

[0014] In a fourth aspect, an embodiment of the present invention provides a computer storage medium for storing a computer program, wherein the computer program enables a computer to implement the routing matching method in the first aspect when executed.

[0015] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, causes the one or more processors to execute the steps in the route matching method shown in the first aspect above.

[0016] In a sixth aspect, an embodiment of the present invention provides a network card, including:

[0017] A processing module, used for obtaining data to be processed;

[0018] A rule storage module is communicatively connected with the processing module, wherein a dictionary tree for matching the data to be processed is stored in the rule storage module, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least two link nodes, and the data corresponding to the link data structure at least includes: a query address of an end link node and address data corresponding to the link data structure;

[0019] The processing module is also used to determine the dictionary tree used to match the data to be processed through the rule storage module, query the dictionary tree to obtain target matching data corresponding to the data to be processed, and determine the routing forwarding rules corresponding to the data to be processed based on the target matching data.

[0020] The route matching method, apparatus, device, network card and computer program product provided by the embodiments of the present invention obtain the data to be processed, determine the dictionary tree used to match the data to be processed, and query the dictionary tree to obtain the target matching data corresponding to the data to be processed, and determine the route forwarding rules corresponding to the data to be processed based on the target matching data. Since the dictionary tree includes a link data structure, and the link data structure is a single branch structure composed of at least one link node, when the dictionary tree is used to perform a matching operation on the data to be processed, the link data structure can be used as a whole node for data matching operations, thereby reducing the number of query nodes in the dictionary tree and the number of node queries on the dictionary tree. This not only improves the efficiency of the route matching operation and the quality and efficiency of accessing the dictionary tree, but also ensures the accuracy and reliability of determining the route forwarding rules corresponding to the data to be processed, further ensuring the practicality of the method. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 A schematic diagram of a dictionary tree provided for a related technical embodiment;

[0023] Figure 2 A schematic diagram of the principle of a route matching method provided by an embodiment of the present invention;

[0024] Figure 3 A schematic diagram of a flow chart of a route matching method provided by an embodiment of the present invention;

[0025] Figure 4 A schematic diagram of a dictionary tree provided by an embodiment of the present invention;

[0026] Figure 5 A schematic diagram of a flow chart of another route matching method provided by an embodiment of the present invention;

[0027] Figure 6A schematic diagram of deleting a node in a dictionary tree provided by an embodiment of the present invention Figure 1 ;

[0028] Figure 7 A schematic diagram of deleting a node in a dictionary tree provided by an embodiment of the present invention Figure 2 ;

[0029] Figure 8 A flowchart of another routing matching method provided by an embodiment of the present invention;

[0030] Fig. 9 A schematic diagram of adding nodes to a dictionary tree provided by an embodiment of the present invention;

[0031] Fig.10 A schematic diagram of the structure of a routing matching device provided by an embodiment of the present invention;

[0032] Fig.11 For Fig.10 A schematic diagram showing the structure of an electronic device corresponding to the routing matching device provided in the embodiment;

[0033] Fig.12 A schematic diagram of the structure of a network card provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0034] In order to make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0035] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "an", and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the situation of including at least one.

[0036] It should be understood that the term "and / or" used in this article is only a way to describe the association relationship of associated devices, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated devices before and after are in an "or" relationship.

[0037] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0038] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.

[0039] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0040] Terminology explanation:

[0041] Longest Prefix Match (LPM): Applicable to network devices such as routers and switches.

[0042] Trie: A tree data structure used to retrieve data from a set of strings. The elements in the trie tree implementation of the LPM algorithm are either 0 or 1.

[0043] Node: Each internal node in the trie.

[0044] Link data structure: a custom structure that can be a direct connection structure across invalid nodes.

[0045] Packet Sequence Numbers: Packet Sequence Numbers, referred to as PSN, are used to mark the sequence numbers assigned to data packets in hardware.

[0046] In order to facilitate understanding of the specific implementation process and implementation effect of the route matching method, device, equipment, network card and computer program product in this embodiment, the following briefly describes the relevant technologies:

[0047] First, the implementation principle of the dictionary tree is briefly described. Assume that the configured routing rules and data are shown in Table 1 below:

[0048]

[0049] Based on the above table data, the corresponding dictionary tree can be generated, such as Figure 1 As shown, the dictionary tree includes multiple nodes, and then the rule matching operation can be performed based on the Longest Prefix Match (LPM) algorithm and the dictionary tree. The highest node in the dictionary tree is the starting position (corresponding to rule *), and "*" is used to indicate that the current node has no configured rules. Then, when the first bit in the data to be matched is 0, it jumps to the node on the lower left (the node has the corresponding rule a, 0*), and when the first bit in the data to be matched is 1, it jumps to the node on the lower right (the node has the corresponding rule d, 1*). Then, according to the subsequent bits in the data to be matched, longer rules are matched. By analogy, the last node can be queried according to each bit in the data to be matched, then stop and return the hit rule. For example: when the data to be processed is "0011", rule b is hit; when the data to be processed is "1000", rule e is hit.

[0050] However, when using the above-mentioned dictionary tree for rule matching, there are the following defects: the dictionary tree includes multiple nodes, each node needs to perform a rule matching operation, which makes the rule matching operation require a large number of queries, thereby causing the performance of route matching to deteriorate.

[0051] In order to solve the above technical problems, this embodiment provides a routing matching method, device, equipment, network card and computer program product. Figure 2 As shown, the execution subject of the route matching method is a route matching device 200, which is connected to the client 100 and the processing device 300 in communication, so as to obtain the data to be processed through the client 100, and then forward the data to be processed to the processing device 300 for corresponding data processing operations. Among them, the route matching device 200 can be implemented as a network card, a server or a cloud server, etc.; when the route matching device 200 is implemented as a cloud server, the route matching method can be executed in the cloud, and several computing nodes (cloud servers) can be deployed in the cloud, and each computing node has computing, storage and other processing resources. In the cloud, multiple computing nodes can be organized to provide a certain service. Of course, a computing node can also provide one or more services. The way to provide the service in the cloud can be to provide a service interface to the outside, and the user calls the service interface to use the corresponding service. The service interface includes a software development kit (Software Development Kit, referred to as SDK), an application programming interface (Application Programming Interface, referred to as API), and the like.

[0052] The route matching device 200 refers to a device that can provide route matching operations in a network virtual environment, and generally refers to a device that uses the network to perform information planning and route matching operations. In terms of physical implementation, the route matching device 200 can be any device that can provide computing services, respond to route matching requests, and perform route matching operations. The device can be integrated on a preset device, for example, a cluster server, a conventional server, a cloud server, a cloud host, a virtual center, etc. The route matching device 200 mainly includes a processor, a hard disk, a memory, a system bus, etc., which is similar to a general computer architecture.

[0053] The client 100 can be implemented as a mobile phone, a personal computer PC, a tablet computer, a setting application, etc. In addition, the basic structure of the client 100 may include: at least one processor. The number of processors depends on the configuration and type of the client 100. The client 100 may also include a memory, which may be volatile, such as: random access memory (Random Access Memory, referred to as RAM), or non-volatile, such as: read-only memory (Read-Only Memory, referred to as ROM), flash memory, etc., or may include both types. The memory usually stores an operating system (Operating System, referred to as OS), one or more application programs, and may also store program data, etc. In addition to the processing unit and the memory, the client 100 also includes some basic configurations, such as: a network card chip, an IO bus, a display component, and some peripheral devices, etc. Optionally, some peripheral devices may include, for example: a keyboard, a mouse, an input pen, a printer, etc. Other peripheral devices are well known in the art and will not be described in detail here.

[0054] In the above embodiment, the client 100 and the route matching device 200, and the route matching device 200 and the processing device 300 are connected to the network, and the network connection can be a wireless or wired network connection. If the client 100 and the route matching device 200, and the route matching device 200 and the processing device 300 are connected in communication, the network standard of the mobile network can be any one of 2G (GSM), 2.5G (GPRS), 3G (WCDMA, TD-SCDMA, CDMA2000, UTMS), 4G (LTE), 4G+ (LTE+), WiMax, 5G, 6G, etc.

[0055] The client 100 is used for users to use so as to start, call or implement data processing operations. Specifically, the client 100 can generate and obtain data to be processed. In some instances, the data to be processed can be obtained through human-computer interaction operations or voice interaction operations. In order to implement corresponding data processing operations, the data to be processed can be sent to the routing matching device 200, so that the routing matching device 200 can perform corresponding data processing operations on the data to be processed.

[0056] The route matching device 200 is connected to the client 100 for communication and is used to obtain the data to be processed sent by the client 100. In order to realize the data processing operation, after obtaining the data to be processed, a dictionary tree for matching the data to be processed can be determined, wherein the dictionary tree includes at least one link data structure, that is, the number of link data structures can be one or more. Specifically, the link data structure is a single branch structure composed of at least one link node, and the data corresponding to the link data structure includes at least: the query address of the end link node and the address data corresponding to the link data structure.

[0057] After determining the dictionary tree for matching the data to be processed, a matching operation is performed on the data to be processed based on the dictionary tree, that is, the dictionary tree is queried to obtain the target matching data corresponding to the data to be processed, and the routing forwarding rules corresponding to the data to be processed are determined based on the target matching data. Then, the data to be processed can be forwarded based on the routing forwarding rules. For example, the data to be processed can be sent to the processing device 300 based on the routing forwarding rules, so that the processing device 300 can perform corresponding processing operations on the data to be processed. In this way, when the matching rules of the data to be processed are determined by using the dictionary tree, since the dictionary tree includes a link data structure, the above-mentioned link data structure is a single branch structure composed of at least one link, and the data corresponding to the link data structure includes at least the query address of the end link node and the address data corresponding to the link data structure, therefore, in the process of performing routing matching based on the dictionary tree, the link data structure can be used as a whole node for rule matching operations, which effectively improves the access efficiency of the link data structure in the dictionary tree, and improves the matching efficiency of the routing matching operation, further ensuring the practicality of the method.

[0058] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0059] Figure 3A schematic diagram of a route matching method provided by an embodiment of the present invention; Figure 3 As shown, this embodiment provides a route matching method, the execution subject of the method is a route matching device, and the route matching device can be implemented as software, or a combination of software and hardware. When the route matching device is implemented as hardware, it can be various electronic devices with route matching capabilities. When the route matching device is implemented as software, it can be installed in the electronic devices listed above. In some examples, the route matching device can be implemented as a network card; based on the above-mentioned route matching device, the route matching method implemented includes:

[0060] Step S301: Obtain data to be processed.

[0061] Step S302: Determine a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least two link nodes, and the data corresponding to the link data structure includes at least: a query address of the end link node and address data corresponding to the link data structure.

[0062] Step S303: query the dictionary tree to obtain target matching data corresponding to the data to be processed, and determine a routing forwarding rule corresponding to the data to be processed based on the target matching data.

[0063] The specific implementation process and effects of each of the above steps are described in detail below:

[0064] Step S301: Obtain data to be processed.

[0065] When there is a demand for data processing, the routing matching device can obtain the data to be processed, wherein the data to be processed can be a message to be processed, or the data to be processed can be data obtained by analyzing and processing the message to be processed. At this time, obtaining the data to be processed can include: obtaining the message to be processed; determining the destination IP address corresponding to the message to be processed; performing a binary conversion operation on the destination IP address to obtain the data to be processed corresponding to the message to be processed, thereby effectively ensuring the stable reliability of obtaining the data to be processed.

[0066] Step S302: Determine a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least two link nodes, and the data corresponding to the link data structure includes at least: a query address of the end link node and address data corresponding to the link data structure.

[0067] After obtaining the data to be processed, in order to accurately implement the data processing operation, a dictionary tree used to match the data to be processed can be determined first, wherein the dictionary tree may include different types of data structures, which refers to a form or format of data organization, management and storage in computer science. For example, the dictionary tree may include a node type data structure (hereinafter referred to as a node data structure) and a link type data structure (hereinafter referred to as a link data structure). The above-mentioned node data structure may refer to a structure composed of a single node, and a single node corresponds to two next-level nodes; the above-mentioned link data structure may refer to a single branch structure composed of at least one link node.

[0068] In some instances, a dictionary tree used to match the data to be processed can be obtained by analyzing and processing a node data structure and a link data structure. At this time, determining the dictionary tree used to match the data to be processed may include: obtaining multiple node data structures and at least one link data structure used to constitute the dictionary tree; performing data sorting operations on the multiple node data structures and at least one link data structure, so as to generate and determine a dictionary tree used to match the data to be processed.

[0069] In other instances, the dictionary tree used to match the data to be processed can be obtained not only through a preset device, but also through multiple rule cache units in the gateway. At this time, determining the dictionary tree used to match the data to be processed may include: determining multiple rule cache units in the network card for storing dictionary trees, and the dictionary trees are stored in the form of fragments in multiple rule cache units; through multiple rule cache units, determining the dictionary tree used to match the data to be processed, thereby effectively ensuring the accuracy and reliability of the determination of the dictionary tree.

[0070] For a dictionary tree, it may include at least one link data structure, that is, the number of link data structures included in a dictionary tree is one or more, such as Figure 4As shown, the link data structure is a single branch structure composed of at least one link node. When the link data structure is a single branch structure composed of 1 link node, the current link node used to constitute the link data structure is the terminal link node; when the link data structure is a single branch structure composed of two or more link nodes, the last link node used to constitute the link data structure is the terminal link node. For the link data structure, the data corresponding to it at least includes: the query address of the terminal link node and the address data corresponding to the link data structure. It should be noted that the data corresponding to the link data structure can include not only the query address of the terminal link node and the address data corresponding to the link data structure, but also include: a rule configuration identifier used to identify whether the link data structure is configured with a forwarding rule; the operation address that hits the current link data structure; the structure type of the terminal link node; the valid number of bits of the address data. In general, the data corresponding to the link data structure can include the element data in Table 2 below:

[0071]

[0072] The meanings of the above element data are as follows:

[0073] vld: a rule configuration flag used to indicate whether the current link data structure is configured with a forwarding rule. When vld is "1", it is determined that the current link data structure is configured with a forwarding rule; when vld is "0", it is determined that the current link data structure is configured with no forwarding rule;

[0074] action_addr: used to indicate the operation address that hits the current link data structure;

[0075] type: used to indicate the structure type of the end link node. When type is "0", it indicates that the structure type is a node data structure. When type is "1", it indicates that the structure type is a link data structure.

[0076] addr: used to indicate the query address corresponding to the end link node. If it is the address of the current node, it means that the matching path has reached the maximum prefix matching operation;

[0077] data: used to represent the address data corresponding to the link data structure;

[0078] Mask: used to indicate the number of valid bits corresponding to the address data.

[0079] For the dictionary tree, it can not only include at least one link data structure, but also include multiple node data structures connected to at least one link data structure, wherein the node data structure is a structure corresponding to two next-level nodes, and for the link data structure and the node data structure, the link data structure can be located after the node data structure; or, the link data structure is located between the two node data structures, that is, the next-level node of the node data structure can be a node data structure, a link data structure or a null value, and the next-level node of the link data structure can be a node data structure, a link data structure or a null value.

[0080] Furthermore, for the node data structure, the data corresponding thereto may at least include: a rule configuration identifier for identifying whether the node data structure is configured with a forwarding rule; an operation address that hits the current node data structure; and a structure type and a query address corresponding to each of the two next-level nodes. Since the node data structure corresponds to two next-level nodes, the data corresponding to the node data structure may include the element data in the following Table 3:

[0081]

[0082] The meanings of the above element data are as follows:

[0083] vld: a rule configuration flag used to indicate whether the current node data structure is configured with a forwarding rule. When vld is "1", it is determined that the current node data structure is configured with a forwarding rule; when vld is "0", it is determined that the current node data structure is configured with no forwarding rule;

[0084] action_addr: used to indicate the operation address that hits the current node data structure;

[0085] left_type: used to indicate the structure type of the next level node. When left_type is "0", it indicates that the structure type is a node data structure. When left_type is "1", it indicates that the structure type is a link data structure.

[0086] left_addr: used to represent the query address of the next-level node. The query address can be accurately expressed based on the structure type of the next-level node. If it is the address of the current node, it means that the matching path has reached the maximum prefix matching operation;

[0087] right_type: used to indicate the structure type of the next level node. When right_type is "0", it indicates that the structure type is a node data structure. When right_type is "1", it indicates that the structure type is a link data structure.

[0088] right_addr: used to represent the query address of the next-level node. The query address can be accurately expressed based on the structure type of the next-level node. If it is the address of the current node, it means that the matching path has reached the maximum prefix matching operation.

[0089] Step S303: query the dictionary tree to obtain target matching data corresponding to the data to be processed, and determine a routing forwarding rule corresponding to the data to be processed based on the target matching data.

[0090] After obtaining the dictionary tree, the data to be processed can be analyzed and matched based on the dictionary tree. Specifically, the query operation can be performed on the data to be processed starting from the starting query node of the dictionary tree and based on the link relationship of each node of the dictionary tree, to obtain the target matching data corresponding to the data to be processed, and determine the routing forwarding rules corresponding to the data to be processed based on the target matching data. Since the dictionary tree includes a link data structure, and the link data structure is a single branch structure composed of at least one link node, when the dictionary tree is used to perform a matching operation on the data to be processed, the link data structure can be used as a whole node for data matching operations, which can improve the efficiency of the routing matching operation and effectively improve the quality and efficiency of accessing the dictionary tree.

[0091] Since the dictionary tree includes two types of data structures, namely, node data structure and link data structure, different types of data structures can correspond to different matching completion identifiers. In some instances, when it is necessary to query the node data structure in the dictionary tree, querying the dictionary tree to obtain the target matching data corresponding to the data to be processed may include: querying the node data structure in the dictionary tree to obtain the query address of the next-level node after the node data structure, the type of the next-level node is a node data structure or a link data structure; determining the current query address of the node data structure; when the query address of the next-level node is consistent with the current query address, determining the target matching data corresponding to the data to be processed based on the node data structure.

[0092] For the dictionary tree, since the type of the starting node of the dictionary tree is often a node data structure, the dictionary tree can be queried based on the node data structure. Specifically, the node data structure in the dictionary tree can be queried, and the next-level node located after the node data structure and the query address of the next-level node can be obtained based on the data corresponding to the node data structure, wherein the type of the next-level node is a node data structure or a link data structure; then the current query address of the node data structure can be determined, and the current query address is analyzed and compared with the query address of the next-level node. When the query address of the next-level node is consistent with the current query address, it means that the operation of querying the dictionary tree at this time has completed the longest prefix matching operation, and then the target matching data corresponding to the data to be processed can be determined based on the current node data structure. The target matching data can be "the operation address that hits the current node data structure", and then the routing matching rules corresponding to the data to be processed can be determined based on the obtained target matching data, thereby effectively ensuring the accuracy and reliability of determining the routing matching rules.

[0093] In other instances, when it is necessary to query a link data structure in a dictionary tree, querying the dictionary tree to obtain target matching data corresponding to the data to be processed may include: querying the link data structure in the dictionary tree; determining a current query address of the link data structure and a query address of an end link node in the link data structure; and when the query address of the end link node is the same as the current query address, determining the target matching data corresponding to the data to be processed based on the link data structure.

[0094] Since the dictionary tree includes a link data structure, during the process of performing a route matching operation, the link data structure in the dictionary tree can be queried, and then the current query address of the link data structure and the query address of the terminal link node in the link data structure can be determined, and the current query address of the link data structure and the query address of the terminal link node are analyzed and compared. When the current query address of the link data structure is consistent with the query address of the terminal link node, it means that the operation of querying the dictionary tree at this time has completed the longest prefix matching operation, and then the target matching data corresponding to the data to be processed can be determined based on the current link data structure. The target matching data can be "the operation address that hits the current link data structure", and then the route matching rules corresponding to the data to be processed can be determined based on the obtained target matching data, thereby effectively ensuring the accuracy and reliability of determining the route matching rules.

[0095] The route matching method provided in this embodiment obtains the data to be processed, determines the dictionary tree used to match the data to be processed, and performs a matching operation on the data to be processed based on the dictionary tree. Since the dictionary tree includes a link data structure, and the link data structure is a single branch structure composed of at least one link node, when querying the dictionary tree, the link data structure can be used as a whole node for data matching operations, thereby reducing the number of query nodes in the dictionary tree and the number of node queries on the dictionary tree. This not only improves the efficiency of the route matching operation and the quality and efficiency of accessing the dictionary tree, but also ensures the accuracy and reliability of determining the route forwarding rules corresponding to the data to be processed, further ensuring the practicality of the method.

[0096] Figure 5 A flow chart of another route matching method provided by an embodiment of the present invention; based on any one of the above embodiments, refer to the attached Figure 5 As shown, this embodiment provides a technical solution for flexibly deleting nodes in a dictionary tree. Specifically, the method in this embodiment may also include:

[0097] Step S501: Obtain the node to be deleted from the dictionary tree.

[0098] Step S502: when the node to be deleted is a node data structure, the rule configuration identifier and the operation address corresponding to the node to be deleted are adjusted to implement the deletion operation of the node to be deleted.

[0099] For the dictionary tree, users can flexibly adjust the dictionary tree according to their needs. For example, when there is a need to delete nodes in the dictionary tree, the nodes to be deleted can be obtained for the dictionary tree. In some instances, the nodes to be deleted can be determined through human-computer interaction; or, the nodes to be deleted can be determined through the node's expiration information. At this time, obtaining the nodes to be deleted for the dictionary tree may include: obtaining the expiration information of each node in the dictionary tree; when the expiration information identifies the node as a valid node, determining that the node corresponding to the expiration information is a non-deleted node; when the expiration information identifies the node as an invalid node, determining that the node corresponding to the expiration information is a node to be deleted, thereby effectively achieving accurate and reliable acquisition of the nodes to be deleted.

[0100] For the dictionary tree, since there are nodes of different structural types in the dictionary tree, and nodes of different structural types have different connection relationships, after obtaining the node to be deleted, in order to stably implement the node deletion operation, the structural type of the node to be deleted can be identified first. Specifically, the structural type of the node to be deleted can be determined by analyzing and processing the element data corresponding to the node to be deleted. Figure 6As shown, when the node to be deleted is a node data structure, since the node data structure corresponds to two next-level nodes, in order to accurately implement the node deletion operation and minimize the impact of the node deletion operation on the dictionary tree, the rule configuration identifier and operation address corresponding to the node to be deleted can be adjusted to implement the deletion operation of the node to be deleted.

[0101] In some instances, adjusting the rule configuration identifier and operation address corresponding to the node to be deleted may include: adjusting the rule configuration identifier to a first identifier used to identify that no forwarding rule is configured, and adjusting the operation address to a null value, so that the node to be deleted can be determined as an invalid node through the adjusted rule configuration identifier and operation address, which is equivalent to implementing the deletion operation of the node to be deleted.

[0102] Correspondingly, when the node to be deleted is a linked data structure, it can be identified whether the node to be deleted corresponds to a next-level node. If the node to be deleted does not correspond to a next-level node, the node to be deleted and the connecting edges between the node to be deleted and other nodes can be directly deleted. Figure 7 As shown, when node a in the dictionary tree is a node to be deleted, since node a does not correspond to a next-level node, node a and edge a corresponding to node a can be directly deleted, thereby realizing the node deletion operation on the dictionary tree; correspondingly, when the node to be deleted is a linked data structure and the node to be deleted corresponds to a next-level node, for example, when node b is the node to be deleted, in order to minimize the impact of the node deletion operation on the dictionary tree, the rule configuration identifier and operation address corresponding to the node b to be deleted can be adjusted to realize the deletion operation of the node to be deleted.

[0103] In this embodiment, by obtaining the node to be deleted for the dictionary tree, when the node to be deleted is a node data structure, the rule configuration identifier and operation address corresponding to the node to be deleted are adjusted to realize the deletion operation of the node to be deleted, thereby effectively realizing the flexible deletion operation of the nodes in the dictionary tree, and then the route matching operation can be performed based on the updated dictionary tree, thereby ensuring the accuracy and reliability of the route matching operation.

[0104] Figure 8 A flowchart of another routing matching method provided by an embodiment of the present invention; based on any of the above embodiments, refer to the attached Figure 8 As shown, this embodiment provides a technical solution for flexibly adding nodes in a dictionary tree. Specifically, the method in this embodiment may also include:

[0105] Step S801: Obtain the node to be added to the dictionary tree.

[0106] Step S802: In the dictionary tree, determine the adding position of the node to be added and at least one associated node that interacts with the node to be added.

[0107] Step S803: adding the node to be added to the dictionary tree based on the adding position, and adjusting part of the data corresponding to at least one associated node to generate an adjusted dictionary tree.

[0108] For the dictionary tree, the user can perform node addition operations on the dictionary tree according to the needs. For example, when there is a demand for adding nodes to the dictionary tree, the nodes to be added for the dictionary tree can be obtained. In some instances, the nodes to be added can be determined through human-computer interaction. After obtaining the nodes to be added, in order to accurately implement the node addition operation, the adding position of the node to be added and at least one associated node that interacts with the node to be added can be determined in the dictionary tree, wherein the adding position can be determined through human-computer interaction, and the at least one associated node that interacts with the node to be added can be determined through the structural information of the dictionary tree and the adding position of the node to be added. This effectively ensures the accuracy and reliability of determining the adding position of the node to be added and at least one associated node.

[0109] After determining the adding position of the node to be added and at least one associated node that affects the node to be added, the node to be added can be added to the dictionary tree based on the adding position. In order to ensure the accuracy of the parameter expression of each node in the dictionary tree, part of the data corresponding to at least one associated node can be adjusted, so that an adjusted dictionary tree can be generated, thereby effectively realizing the node addition operation of the dictionary tree.

[0110] Example 1, see Attachment Fig. 9 As shown, after the adding position of the node a to be added is node 9, since the node 9 at the adding position is the end node of the dictionary tree, based on the above-mentioned adding position and the structure of the dictionary tree, it can be determined that at least one associated node that interacts with the node a to be added may include: node 5 and node 9, and then part of the data of the above-mentioned nodes 5 and 9 can be adjusted, wherein part of the data may include: an operation address action_addr for indicating a hit on the current link data structure, a query address addr for indicating the end link node, an address data data corresponding to the link data structure, a valid bit mask corresponding to the address data data, etc., thereby realizing the node adding operation of the dictionary tree.

[0111] Example 2, after the adding position of the node b to be added is node 10, since the node 10 at the adding position is the middle node of the dictionary tree, based on the above adding position and the structure of the dictionary tree, it can be determined that at least one associated node that interacts with the node b to be added may include node 10, and then part of the data of the above node 10 can be adjusted, wherein part of the data may include: the structure type type used to represent the end link node, the structure type corresponding to each of the two next-level nodes, and the query address (left_type, left_addr, right_type, and right_addr). It can be seen from the above that different adding positions and the structure of the dictionary tree can determine different associated nodes corresponding to the node to be added, thereby realizing the node addition operation of the dictionary tree.

[0112] In this embodiment, by obtaining the node to be added for the dictionary tree, the adding position of the node to be added and at least one associated node that affects the node to be added are determined in the dictionary tree, and then the node to be added is added to the dictionary tree based on the adding position, and part of the data corresponding to at least one associated node is adjusted to generate an adjusted dictionary tree, thereby effectively realizing the node adding operation to the dictionary tree, and then the route matching operation can be performed based on the adjusted dictionary tree, thereby ensuring the accuracy and reliability of the route matching operation.

[0113] Fig.10 A schematic diagram of a routing matching device provided by an embodiment of the present invention; Fig.10 As shown, this embodiment provides a routing matching device, which can be used to perform the above Figure 3 The route matching method shown, the route matching device may include:

[0114] A first acquisition module 11, used to acquire data to be processed;

[0115] The first determination module 12 is used to determine a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least two link nodes, and the data corresponding to the link data structure at least includes: a query address of the end link node and address data corresponding to the link data structure;

[0116] The first processing module 13 is used to query the dictionary tree to obtain target matching data corresponding to the data to be processed, and determine a routing forwarding rule corresponding to the data to be processed based on the target matching data.

[0117] In some examples, the data corresponding to the link data structure also includes:

[0118] A rule configuration identifier used to identify whether a link data structure is configured with a forwarding rule;

[0119] The operation address that hits the current link data structure;

[0120] The structure type of the end link node;

[0121] The number of significant digits of address data.

[0122] In some examples, the dictionary tree also includes multiple node data structures connected to at least one link data structure, and the node data structure corresponds to two next-level nodes.

[0123] In some examples, the data corresponding to the node data structure includes at least:

[0124] A rule configuration identifier used to identify whether a node data structure is configured with a forwarding rule;

[0125] The operation address that hits the current node data structure;

[0126] The structure type and query address corresponding to each of the two next-level nodes.

[0127] In some examples, the link data structure may be located after the node data structure; or, the link data structure may be located between two node data structures.

[0128] In some examples, the first acquisition module 11 and the first processing module 13 in this embodiment are used to perform the following steps:

[0129] A first acquisition module 11 is used to acquire a node to be deleted from the dictionary tree;

[0130] The first processing module 13 is used for adjusting the rule configuration identifier and the operation address corresponding to the node to be deleted when the node to be deleted is a node data structure, so as to implement the deletion operation of the node to be deleted.

[0131] In some instances, when the first processing module 13 adjusts the rule configuration identifier and operation address corresponding to the node to be deleted, the first processing module 13 is used to execute: adjusting the rule configuration identifier to a first identifier for identifying that no forwarding rule is configured, and adjusting the operation address to a null value.

[0132] In some examples, the first acquisition module 11, the first determination module 12 and the first processing module 13 in this embodiment are used to perform the following steps:

[0133] A first acquisition module 11 is used to acquire a node to be added to the dictionary tree;

[0134] A first determination module 12 is used to determine, in the dictionary tree, the adding position of the node to be added and at least one associated node that interacts with the node to be added;

[0135] The first processing module 13 is used to add the node to be added to the dictionary tree based on the adding position, and adjust part of the data corresponding to at least one associated node to generate an adjusted dictionary tree.

[0136] In some instances, when the first processing module 13 queries the dictionary tree to obtain target matching data corresponding to the data to be processed, the first processing module 13 is used to execute: query the node data structure in the dictionary tree to obtain the query address of the next-level node located after the node data structure, and the type of the next-level node is a node data structure or a link data structure; determine the current query address of the node data structure; when the query address of the next-level node is consistent with the current query address, determine the target matching data corresponding to the data to be processed based on the node data structure.

[0137] In some instances, when the first processing module 13 queries the dictionary tree to obtain target matching data corresponding to the data to be processed, the first processing module 13 is used to execute: querying the link data structure in the dictionary tree; determining the current query address of the link data structure and the query address of the end link node in the link data structure; when the query address of the end link node is the same as the current query address, determining the target matching data corresponding to the data to be processed based on the link data structure.

[0138] Fig.10 The device shown can perform Figure 2-Figure 9 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 2-Figure 9 The implementation process and technical effects of this technical solution refer to Figure 2-Figure 9 The description in the illustrated embodiment will not be repeated here.

[0139] In one possible design, Fig.10 The structure of the routing matching device shown can be implemented as an electronic device, which can be a controller, a personal computer, a server, a network card, etc. Fig.11 As shown, the electronic device may include: a first processor 21 and a first memory 22. The first memory 22 is used to store the corresponding electronic device to execute the above Figure 2-Figure 9 The program of the route matching method provided in the illustrated embodiment, the first processor 21 is configured to execute the program stored in the first memory 22 .

[0140] The program includes one or more computer instructions, wherein the one or more computer instructions can implement the following steps when executed by the first processor 21: obtaining the data to be processed; determining a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least one link node, and the data corresponding to the link data structure includes at least: the query address of the end link node and the address data corresponding to the link data structure; querying the dictionary tree to obtain the target matching data corresponding to the data to be processed, and determining the routing forwarding rules corresponding to the data to be processed based on the target matching data.

[0141] Furthermore, the first processor 21 is also used to execute the aforementioned Figure 2-Figure 9 All or part of the steps in the illustrated embodiments.

[0142] The structure of the electronic device may further include a first communication interface 23 for the electronic device to communicate with other devices or a communication network.

[0143] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by electronic devices, which includes instructions for executing the above Figure 2-Figure 9 The procedures involved in the route matching method in the illustrated embodiment.

[0144] In addition, an embodiment of the present invention provides a computer program product, including: a computer-readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, causing the one or more processors to execute the above Figure 2-Figure 9 The steps in the route matching method in the method embodiment are shown.

[0145] Fig.12 A schematic diagram of the structure of a network card provided by an embodiment of the present invention; Fig.12 As shown, this embodiment provides a network card, which can execute the above Figure 3 The routing matching method shown, specifically, the network card may include:

[0146] A processing module 31 is used to obtain data to be processed;

[0147] The rule storage module 32 is in communication with the processing module 31. The rule storage module 32 stores a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least two link nodes, and the data corresponding to the link data structure at least includes: a query address of the end link node and address data corresponding to the link data structure;

[0148] The processing module 31 is also used to determine the dictionary tree used to match the data to be processed through the rule storage module 32, query the dictionary tree, obtain target matching data corresponding to the data to be processed, and determine the routing forwarding rules corresponding to the data to be processed based on the target matching data.

[0149] Among them, the number of processing modules 31 included in the network card can be multiple, for example: the multiple processing modules 31 can include processing module 0, processing module 1...processing module n-1, and the above-mentioned processing module 31 is used to perform routing matching operations on the data to be processed. Since the number of processing modules 31 is multiple, in different application scenarios, the processing modules 31 may correspond to different loads. In order to ensure the quality and efficiency of analyzing and processing the data to be processed, the network card can also include a scheduling module 30. The scheduling module 30 is communicated with the multiple processing modules 31 and is used to select a target processing module for analyzing and processing the data to be processed from the multiple processing modules 31. Among them, the selection logic of the processing module 31 can be a load balancing logic, which effectively ensures the accuracy and reliability of determining the target processing module.

[0150] Specifically, the specific implementation method and implementation principle of each step performed by the processing module 31 and the rule storage module 32 are the same as those described above. Figure 3 The specific implementation method and implementation principle of the routing matching method in the illustrated embodiment are similar, and specific reference may be made to the above Figure 3 For the contents of the embodiment shown in the figure, the parts not described in detail in this embodiment can be referred to the Figure 3 The technical effect of this technical solution can be seen in Figure 3 The description in the illustrated embodiment will not be repeated here.

[0151] In other examples, in order to improve the quality and efficiency of the data processing operation of the network card, the rule storage module 32 in the network card may include multiple rule cache units 3201, and the dictionary tree is stored in the multiple rule cache units 3201 in the form of fragments, and all the dictionary tree fragments in the multiple rule cache units 3201 can constitute a complete dictionary tree. In addition, in order to ensure the quality and efficiency of determining the dictionary tree for matching the processed data, each rule cache unit 3201 can be correspondingly connected to a cache scheduling unit 3202 for communication, and the cache scheduling unit 3202 is located between the processing module 31 and the rule cache unit 3201, so that the processing module 31 can obtain the dictionary tree fragment stored in the corresponding rule cache unit 3201 through the cache scheduling unit 3202; in the process of matching the routing forwarding rule based on the dictionary tree, the matching operation of the routing forwarding rule can be synchronously performed based on the dictionary tree fragments in the multiple rule cache units 3201, which can effectively improve the matching quality and efficiency of the routing forwarding rule.

[0152] In some other instances, the number of data to be processed may be one or more. In order to ensure that the routing matching operation is performed on the data to be processed stably and sequentially, the processing module 31 in the network card in this embodiment can also be used to perform the following steps: generate a data packet serial number corresponding to the data to be processed, wherein the data packet serial number can be determined by the processing module 31 based on the data reception time of the data to be processed, and then the data packet serial number can be associated with the data to be processed and stored.

[0153] In other instances, in order to accurately output the routing matching rules after the matching operation is performed on the data to be processed, the network card in this embodiment may also include an output sequence preservation module 33, which is communicatively connected to the processing module 31, and is used to cache the routing matching rules corresponding to the data to be processed, and output the routing matching rules according to the data packet sequence number of the data to be processed. This effectively realizes the sequential output of the routing matching rules in the order corresponding to the data packet sequence number, and then the data to be processed can be analyzed and processed based on the sequentially output routing matching rules, which is beneficial to improving the quality and efficiency of data processing.

[0154] In specific implementation, when there is a routing matching requirement for the data to be processed, the scheduling module 30 in the network card can obtain the data to be processed. The data to be processed may refer to the commonly used information in the network message, such as the destination IP address. After the scheduling module 30 obtains the data to be processed, a target processing module 31 for analyzing and processing the data to be processed can be selected from multiple processing modules 31, wherein the target processing module 31 may be a processing module 31 that is in an idle state or has a low load level among the multiple processing modules 31. After the target processing module 31 obtains the data to be processed, the data to be processed may be marked with a sequence number. The above-mentioned sequence number is used to identify the receiving order of the data to be processed, that is, it can be specifically implemented as a data packet sequence number PSN.

[0155] After the target processing module 31 obtains the data to be processed, the dictionary tree used to match the data to be processed can be determined through the rule storage module 32, and then the data to be processed can be matched with rules based on the dictionary tree to determine the routing forwarding rules corresponding to the data to be processed and after the longest prefix match, and then the routing forwarding rules can be sent to the output sequence preservation module 33 through the target processing module 31, so that the output sequence preservation module 33 can obtain the routing forwarding rules corresponding to the data to be processed and cache the routing forwarding rules. Then the routing forwarding rules can be output in sequence based on the sequence preservation number corresponding to the data to be processed, so that the output order of the routing forwarding rules is consistent with the receiving order corresponding to the data to be processed, which is conducive to improving the quality and efficiency of analyzing and processing the data to be processed.

[0156] For example, the dictionary tree includes data in the following two data tables (including: Table 4 and Table 5), and then a matching operation is performed on the data to be processed based on the dictionary tree. Specifically, determining the routing forwarding rules corresponding to the data to be processed may include the following process:

[0157]

[0158]

[0159] For example, when the data to be processed is binary data "1000" with a valid digit number of 4, the query process of the routing forwarding rule of the data to be processed includes the following process:

[0160] 1) First, query the entry address addr "0" of the fixed dictionary tree to obtain the node data of address 0. Since this node is not configured with a forwarding rule, there is currently no hit rule;

[0161] 2) Based on the first bit "1" in the data to be matched, the right branch of the dictionary tree is queried, and then the data "right_type" and "right_addr" corresponding to the right branch in the dictionary tree can be queried to determine that the address to be queried for the next level node is "2". The data corresponding to the query address "2" is parsed according to the node data structure, and the operation address of the current hit rule is determined to be "3";

[0162] 3) Based on the second bit "0" in the data to be matched, the left branch of the dictionary tree is queried, and then the left_type and left_addr of the address "2" can be queried for analysis. It can be determined that the query address of the next level node is "5", and the returned data is parsed according to the link data structure.

[0163] 4) After obtaining the link data structure by querying the address "5", it is found that the link data structure matches 2 bits, and the data is "00". The above data is the same as the data of the 2nd and 3rd bits in the data to be processed, which means that the routing forwarding rule of the link data structure is matched successfully, and the execution address of the hit forwarding rule is "4". At the same time, since the next-level node address of the link data structure is "5", that is, the link data structure itself, it indicates that there is no longer rule to match later, that is, the longest prefix matching operation is completed; if the next-level node address of the link data structure is not "5", the next-level node address can be continued to be searched for rule matching operations until the longest prefix matching operation is completed, and then the routing forwarding rules corresponding to the data to be processed can be obtained; then the data to be processed can be forwarded based on the routing forwarding rules to complete the forwarding operation of the data to be processed.

[0164] The network card provided in this embodiment effectively realizes the ability to perform route matching operations based on the dictionary tree composed of the node data structure and the link data structure. Since at least one link node included in the link data structure can be used as an integral structure, the efficiency of the route matching operation can be effectively improved when performing rule matching based on the dictionary tree; and when storing the data of the dictionary tree, the link structure data can be stored as an integral node data structure, thereby reducing the storage resources required by the dictionary tree; in addition, through the multiple processing modules 31 and multiple rule cache units 3201 configured in the gateway, the concurrent access operation of the dictionary tree by multiple operation cores and multiple rule cache units 3201 is realized, which effectively improves the bandwidth for accessing the cache, thereby making the data processing operation of the network card have the advantage of high processing bandwidth, which is conducive to the high performance development trend of the network card hardware and further improves the practicality of the solution.

[0165] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0166] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the objectives of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement the scheme without creative effort.

[0167] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0168] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0169] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide the functions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps of the functions specified in the blocks or multiple blocks. In a typical configuration, the computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0170] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A routing matching method, characterized in that: include: Get the data to be processed; Determine a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least one link node, and the data corresponding to the link data structure at least includes: a query address of the end link node and address data corresponding to the link data structure; the dictionary tree also includes a plurality of node data structures connected to the at least one link data structure, and the node data structure corresponds to two next-level nodes; Querying the dictionary tree to obtain target matching data corresponding to the data to be processed, and determining a routing forwarding rule corresponding to the data to be processed based on the target matching data; The querying of the dictionary tree to obtain target matching data corresponding to the data to be processed includes: Querying the link data structure in the dictionary tree; Determine a current query address of the link data structure and a query address of an end link node in the link data structure; When the query address of the end link node is the same as the current query address, target matching data corresponding to the data to be processed is determined based on the link data structure.

2. The method according to claim 1, characterized in that The data corresponding to the link data structure also includes: A rule configuration identifier used to identify whether a link data structure is configured with a forwarding rule; The operation address that hits the current link data structure; The structure type of the end link node; The number of significant digits of address data.

3. The method according to claim 1, characterized in that The data corresponding to the node data structure at least includes: A rule configuration identifier used to identify whether a node data structure is configured with a forwarding rule; The operation address that hits the current node data structure; The structure type and query address corresponding to each of the two next-level nodes.

4. The method according to claim 1, characterized in that: The link data structure is located after the node data structure; or, the link data structure is located between two node data structures.

5. The method according to claim 2 or 3, characterized in that: The method further comprises: Obtaining a node to be deleted from the dictionary tree; When the node to be deleted is a node data structure, the rule configuration identifier and the operation address corresponding to the node to be deleted are adjusted to implement the deletion operation of the node to be deleted.

6. The method according to claim 5, characterized in that The rule configuration identifier and the operation address corresponding to the node to be deleted are adjusted, including: The rule configuration identifier is adjusted to a first identifier for identifying that no forwarding rule is configured, and the operation address is adjusted to a null value.

7. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Obtaining a node to be added for the dictionary tree; In the dictionary tree, determining the adding position of the node to be added and at least one associated node that interacts with the node to be added; The node to be added is added to the dictionary tree based on the adding position, and part of the data corresponding to the at least one associated node is adjusted to generate an adjusted dictionary tree.

8. The method according to any one of claims 1 to 4, characterized in that: Querying the dictionary tree to obtain target matching data corresponding to the data to be processed includes: Querying the node data structure in the dictionary tree to obtain a query address of a next-level node located after the node data structure, wherein the type of the next-level node is a node data structure or a link data structure; Determining a current query address of the node data structure; When the query address of the next-level node is consistent with the current query address, target matching data corresponding to the data to be processed is determined based on the node data structure.

9. A routing matching device, characterized in that: include: A first acquisition module, used to acquire data to be processed; A first determination module is used to determine a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least two link nodes, and the data corresponding to the link data structure at least includes: a query address of an end link node and address data corresponding to the link data structure; the dictionary tree also includes a plurality of node data structures connected to the at least one link data structure, and the node data structure corresponds to two next-level nodes; A first processing module, configured to query the dictionary tree to obtain target matching data corresponding to the data to be processed, and determine a routing forwarding rule corresponding to the data to be processed based on the target matching data; The first processing module is also used to query the link data structure in the dictionary tree; determine the current query address of the link data structure and the query address of the end link node in the link data structure; when the query address of the end link node is the same as the current query address, determine the target matching data corresponding to the data to be processed based on the link data structure.

10. A network card, characterized in that: include: A processing module, used for obtaining data to be processed; A rule storage module is communicatively connected with the processing module, wherein the rule storage module stores a dictionary tree for matching the data to be processed, wherein the dictionary tree includes at least one link data structure, the link data structure is a single branch structure composed of at least two link nodes, and the data corresponding to the link data structure at least includes: a query address of the end link node and address data corresponding to the link data structure; the dictionary tree also includes a plurality of node data structures connected to at least one link data structure, and the node data structure corresponds to two next-level nodes; The processing module is further used to determine a dictionary tree for matching the data to be processed through the rule storage module, query the dictionary tree to obtain target matching data corresponding to the data to be processed, and determine a routing forwarding rule corresponding to the data to be processed based on the target matching data; The processing module is also used to query the link data structure in the dictionary tree; determine the current query address of the link data structure and the query address of the end link node in the link data structure; when the query address of the end link node is the same as the current query address, determine the target matching data corresponding to the data to be processed based on the link data structure.

11. The network card according to claim 10, characterized in that: The number of the processing modules is multiple; the rule storage module includes multiple rule cache units, and the dictionary tree is stored in the multiple rule cache units in the form of fragments.

12. The network card according to claim 10, characterized in that: The processing module is further used for: Generate a data packet sequence number corresponding to the data to be processed; The data packet sequence number is associated with the data to be processed and stored.

13. The network card according to claim 12, characterized in that: The network card also includes: The output sequence preservation module is connected to the processing module for caching the routing matching rules corresponding to the data to be processed and outputting the routing matching rules according to the data packet sequence number of the data to be processed.

14. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any one of claims 1 to 8.

15. A computer storage medium, characterized in that: Used to store a computer program, which enables a computer to implement the method of any one of claims 1 to 8 when executed.

16. A computer program product, characterized in that include: A computer program, when executed by a processor of an electronic device, causes the processor to execute the steps of any one of the methods of claims 1 to 8.

Citation Information

Patent Citations

  • Matching method and electronic device

    CN107609032A

  • Data storage method and device, data query method and device and electronic equipment

    CN107862026A