A method and apparatus for searching a routing table entry

By hierarchically storing routing information in SRAM and DRAM and using a combination of subtree root nodes and subtrees for lookup, the problem of high complexity in router IP address lookup is solved, enabling fast and efficient routing table lookup and meeting the requirements of large-capacity FIB.

CN118282943BActive Publication Date: 2025-11-18RUIJIE NETWORKS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211662870.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-23
Publication Date
2025-11-18
Estimated Expiration
2042-12-23

AI Technical Summary

Technical Problem

In existing technologies, router IP address lookup algorithms are highly complex and cannot meet the needs of large-capacity FIB lookups. Especially after the widespread adoption of IPv6, the number of FIB entries has increased and the prefix distribution has become more extensive. Existing lookup methods, such as those based on TCAM, GPU, and CPU+DRAM, suffer from speed, power consumption, capacity, or latency issues.

Method used

The root node of the target subtree is located in the static random access memory (SRAM), the first target routing table entry is determined based on the prefix, and the target subtree with matching IP addresses is located in the dynamic random access memory (DRAM). By combining the first and second target routing table entries, a fast and efficient routing table entry lookup is achieved.

Benefits of technology

It implements hierarchical storage of routing information in SRAM and DRAM, enabling fast and efficient lookup of routing table entries that match the target IP address, thus meeting the router's high-efficiency forwarding requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118282943B_ABST
    Figure CN118282943B_ABST
Patent Text Reader

Abstract

The application relates to the communication technical field, and discloses a method and device for searching a routing table item, the method is as follows: searching a target sub-tree root node matched with a target IP address in an SRAM, the SRAM comprises a sub-tree root node set for indicating routing table item information, each sub-tree root node carries a prefix, determining a first target routing table item based on the prefix of the target sub-tree root node, searching a second target routing table item matched with a remaining IP address in a target sub-tree in a DRAM based on the target sub-tree root node, and combining the first target routing table item and the second target routing table item to obtain a target routing table item matched with the target IP address, the flexible storage of the routing information in the sub-tree root node and the sub-tree can quickly and efficiently find the target routing table item matched with the target IP address.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and provides a method and apparatus for finding routing table entries. Background Technology

[0002] Currently, routers, as core devices for Internet interconnection, are one of the main bottlenecks in network communication, and their performance directly affects the quality of network interconnection. Efficient IP address lookup algorithms are a crucial factor influencing router forwarding efficiency. With the expansion of the Internet, the size of routing table entries in core routers is increasing daily. With the introduction of Classless Inter-Domain Routing (CIDR), IP address lookup has transformed from an exact match problem into an optimal match problem, requiring the use of the Longest Prefix Match (LPM) algorithm, thus significantly increasing the complexity of IP address lookup. In TCP / IP, the Forwarding Information Base (FIB) is a microcosm of routing table entries, storing valid, aggregated routing information that directly guides packet forwarding.

[0003] Furthermore, with the expansion of communication networks and the popularization of IPv6, the number of FIB entries is increasing daily, and the prefix distribution is becoming more widespread. This further increases the requirements for FIB lookup algorithms. At the same time, the limitations of high-speed memory capacity pose new requirements for how to store and quickly look up entries.

[0004] Existing technologies include the following lookup methods: First, TCAM-based lookup. Although TCAM-based lookup is fast, it consumes a lot of power, is expensive, and usually has a small capacity, making it difficult to use as a solution for large-capacity FIB lookup. Second, GPU-based lookup. This method has a large latency, and if a lookup is performed on a single packet, the bandwidth of the FIB lookup cannot meet the needs of a large number of forwardings on the network. In addition, the complexity of route updates is increased due to specially designed jump tables and other structures. Third, CPU and DRAM-based lookup. Since the cache capacity in the CPU is extremely small, multiple DRAM accesses are required, which cannot meet the latency requirements of the core router. Summary of the Invention

[0005] This application provides a method and apparatus for finding routing table entries, so as to quickly and efficiently find routing table entries that match the target IP address.

[0006] The specific technical solution provided in this application is as follows:

[0007] In a first aspect, embodiments of this application provide a method for looking up routing table entries, including:

[0008] The target subtree root node that matches the target IP address is searched in the static random access memory (SRAM). The SRAM includes a set of subtree root nodes that indicate routing table entry information. The set of subtree root nodes includes multiple connected subtree root nodes. Each of the multiple subtree root nodes includes a prefix. The length of the prefix of the multiple subtree root nodes is not fixed. The prefix of the target subtree root node is used to characterize the routing information between the target subtree root node and the root nodes of the set of subtree root nodes.

[0009] The first target routing table entry is determined based on the prefix of the root node of the target subtree;

[0010] Based on the root node of the target subtree, a target subtree matching the remaining IP address is searched in the dynamic random access memory (DRAM). A second target routing table entry is determined based on the target subtree. The remaining IP address is the portion of the target IP address that is not matched with the IP address in the first target routing table entry. The root node of the target subtree includes at least one subtree, and the at least one subtree is used to characterize the routing information included in the root node of the target subtree. The target subtree is one of the at least one subtree.

[0011] The first destination routing table entry and the second destination routing table entry are combined to obtain a destination routing table entry that matches the destination IP address.

[0012] Optionally, it also includes establishing a set of subtree root nodes;

[0013] Building the subtree root node set includes:

[0014] Connect the root node of the tree to two subtree root node strings, wherein each subtree root node string includes multiple subtree root nodes connected in series;

[0015] Each subtree root node, except for the root node of the subtree root node set, is connected to the previous subtree root node by a prefix, wherein the prefix includes a first direction prefix and / or a second direction prefix, the first direction prefix represents a routing value of 0, and the second direction prefix represents a routing value of 1.

[0016] Each subtree root node, except for the root node of the subtree root node set, is associated with at least one subtree, wherein each subtree includes first-direction subtree information and / or second-direction subtree information, the routing value represented by the first-direction subtree information is 0, and the routing value represented by the second-direction subtree information is 1.

[0017] Construct a set of subtree root nodes based on the root node, each subtree root node in the two subtree root node strings, the prefix, and the subtree.

[0018] Optionally, the root node of the target subtree that matches the target IP address is searched in the SRAM, including:

[0019] Align the starting path information of the target IP address with the root node of the subtree root node set pre-stored in SRAM;

[0020] Based on the prefix connected to the root node of the Nth subtree, find the (N+1)th subtree root node that matches the target IP address, where N is a natural number starting from 1;

[0021] The root node of the (N+1)th subtree is determined as the root node of the target subtree.

[0022] Optionally, the first target routing table entry is determined based on the prefix of the target subtree root node, including:

[0023] Determine the routing order of the prefix based on the root node, the root node of the Nth subtree, and the root node of the (N+1)th subtree;

[0024] Based on the routing order, the prefixes are combined according to the routing values ​​represented by the first directional prefix and / or the second directional prefix, and the combined routing value is determined as the first destination routing table entry.

[0025] Optionally, based on the root node of the target subtree, a target subtree matching the remaining IP addresses is searched in DRAM, and a second target routing table entry is determined based on the target subtree, including:

[0026] Locate the target subtree address in DRAM that corresponds to the memory address of the target subtree root node;

[0027] The subtree stored in the target subtree address is identified as the target subtree that matches the remaining IP address;

[0028] Based on the longest prefix matching algorithm, the routing information in the target subtree that matches the remaining IP addresses is determined as the second target routing table entry.

[0029] Optionally, the first destination routing table entry and the second destination routing table entry are combined to obtain a destination routing table entry that matches the destination IP address, including:

[0030] Determine the last route value in the first destination routing table entry;

[0031] The last routing value of the first destination routing table entry is serially concatenated with the second destination routing table entry to obtain the serially concatenated first destination routing table entry and second destination routing table entry.

[0032] The first and second destination routing table entries after serial connection are identified as destination routing table entries that match the destination IP address.

[0033] Optionally, it also includes:

[0034] Determine and output the next-hop information corresponding to the target routing table entry.

[0035] Secondly, embodiments of this application also provide an apparatus for looking up routing table entries, comprising:

[0036] The first lookup unit is used to look up the target subtree root node that matches the target IP address in the static random access memory (SRAM). The SRAM includes a set of subtree root nodes for indicating routing table entry information. The set of subtree root nodes includes multiple connected subtree root nodes. Each subtree root node includes a prefix. The length of the prefix of the multiple subtree root nodes is not fixed. The prefix of the target subtree root node is used to characterize the routing information between the target subtree root node and the root nodes of the set of subtree root nodes.

[0037] The determining unit is used to determine the first target routing table entry based on the prefix of the root node of the target subtree;

[0038] The second lookup unit is used to search for a target subtree that matches the remaining IP address in the dynamic random access memory (DRAM) based on the root node of the target subtree, and to determine a second target routing table entry based on the target subtree. The remaining IP address is the part of the target IP address that is not matched with the IP address in the first target routing table entry. The root node of the target subtree includes at least one subtree, and the at least one subtree is used to characterize the routing information included in the root node of the target subtree. The target subtree is one of the at least one subtree.

[0039] The combination unit is used to combine the first destination routing table entry and the second destination routing table entry to obtain a destination routing table entry that matches the destination IP address.

[0040] Thirdly, a smart terminal includes:

[0041] Memory, used to store executable instructions;

[0042] A processor for reading and executing executable instructions stored in memory to implement the method as described in any of the first aspects.

[0043] Fourthly, a computer-readable storage medium, when instructions in the storage medium are executed by a processor, enables the processor to perform the method described in any of the first aspects above.

[0044] The beneficial effects of this application are as follows:

[0045] In summary, the embodiments of this application provide a method and apparatus for finding routing table entries. The method includes: searching for a target subtree root node that matches a target IP address in an SRAM, wherein the SRAM includes a set of subtree root nodes for indicating routing table entry information, the set of subtree root nodes includes multiple connected subtree root nodes, each of the multiple subtree root nodes includes a prefix, the length of the prefix of the multiple subtree root nodes is not fixed, the prefix of the target subtree root node is used to characterize the routing information between the target subtree root node and the root nodes of the set of subtree root nodes, determining a first target routing table entry based on the prefix of the target subtree root node, and retrieving the target subtree root node from the DRAM. The system searches for a target subtree that matches the remaining IP address. Based on the target subtree, it determines a second target routing table entry. The remaining IP address is the part of the target IP address that is not matched with the IP address in the first target routing table entry. The root node of the target subtree includes at least one subtree, which is used to represent the routing information included in the root node of the target subtree. The target subtree is one of the at least one subtree. The first target routing table entry and the second target routing table entry are combined to obtain the target routing table entry that matches the target IP address. The above method of hierarchically and flexibly storing routing information in the root node and subtree facilitates the quick and efficient search for the routing table entry that matches the target IP address.

[0046] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0047] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0048] Figure 1 This is a schematic diagram of the system architecture for finding routing table entries in an embodiment of this application;

[0049] Figure 2 This is a schematic diagram of the process for finding a routing table entry in an embodiment of this application;

[0050] Figure 3 This is a schematic diagram of the process for determining the root node of the target subtree in an embodiment of this application;

[0051] Figure 4 This is a schematic diagram of the process for determining the first target routing table entry in an embodiment of this application;

[0052] Figure 5This is a flowchart illustrating the process of determining the target subtree in an embodiment of this application;

[0053] Figure 6 This is a schematic diagram illustrating the process of determining the target routing table entry in an embodiment of this application;

[0054] Figure 7 This is a schematic diagram illustrating the determination of a set of subtree root nodes in an embodiment of this application; Figure 8 This is a schematic diagram of the logical architecture of a device for looking up routing table entries according to an embodiment of this application;

[0055] Figure 9 This is a schematic diagram of the physical architecture of a smart terminal according to an embodiment of this application. Detailed Implementation

[0056] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are only some embodiments of the technical solutions of this application, and not all embodiments. Based on the embodiments recorded in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the technical solutions of this application.

[0057] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in sequences other than those illustrated or described herein.

[0058] The preferred embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0059] See Figure 1 As shown in the embodiments of this application, the system includes at least one smart terminal. Figure 1 When the target IP address is entered into the smart terminal, the smart terminal will search for the route that best matches the target IP address in the pre-stored large-capacity Forwarding Information Base (FIB). The FIB is a microcosm of the routing table entries, which stores a large amount of valid and aggregated routing information that is directly used to guide the forwarding of data packets.

[0060] In this embodiment of the application, a method for finding routing table entries is implemented, which is mainly executed on the smart terminal side, and will be described in detail below.

[0061] See Figure 2As shown in the embodiments of this application, a specific process for finding a routing table entry is as follows:

[0062] Step 201: Locate the target subtree root node that matches the target IP address in the Static Random-Access Memory (SRAM). The SRAM includes a set of subtree root nodes that indicate routing table entry information. The set of subtree root nodes includes multiple connected subtree root nodes. Each of the multiple subtree root nodes includes a prefix. The length of the prefix of the multiple subtree root nodes is not fixed. The prefix of the target subtree root node is used to characterize the routing information between the target subtree root node and the root nodes of the set of subtree root nodes.

[0063] The following describes in detail the method for creating the subtree root node set in this embodiment of the application. Creating the subtree root node set includes:

[0064] (1) Connect the root node of the tree to two subtree root node strings, wherein each subtree root node string includes multiple subtree root nodes connected in series.

[0065] In this embodiment, the starting point of the subtree root node set is the tree root node, which is connected to two subtree root node strings. The two subtree root node strings include a first subtree root node string and a second subtree root node string. The difference between the first subtree root node string and the second subtree root node string is that the first subtree root node string includes a second subtree root node connected to the tree root node through a first directional prefix, and the second subtree root node string includes a next subtree root node connected to the tree root node through a second directional prefix.

[0066] It should be noted that the first subtree root node mentioned above can also be connected to three or more subtree root node strings, and this application does not impose any restrictions on this. In addition, each subtree root node string includes multiple subtree root nodes connected in series, and the number of subtree root nodes included in each subtree root node string can be the same or different.

[0067] (2) Connect each subtree root node except the root node of the subtree root node set to the root node through a prefix, wherein the prefix includes a first direction prefix and / or a second direction prefix, the first direction prefix represents a routing value of 0, and the second direction prefix represents a routing value of 1.

[0068] In this embodiment of the application, the prefix of the root node is an empty set. That is, apart from the root node, each subtree root node is connected to the previous subtree root node through a prefix. However, the length of the prefix between each two subtree root nodes is different, and the direction of the prefix is ​​also uncertain. Specifically, the routing value represented by the first direction prefix is ​​0, and the routing value represented by the second direction prefix is ​​1. That is, the number of 0 and / or 1 between each two subtree root nodes is different.

[0069] (3) Associating each subtree root node, except for the root node of the subtree root node set, with a subtree, wherein the subtree includes first direction subtree information and / or second direction subtree information, the routing value represented by the first direction subtree information is 0, and the routing value represented by the second direction subtree information is 1.

[0070] In this embodiment of the application, after determining the matching subtree root node for the target IP address according to the longest prefix matching principle, that is, after determining that the next subtree root node connected to the above-mentioned matching subtree root node no longer matches the target IP address, the matching target subtree will continue to be searched for the remaining IP addresses. Based on this, the concept of subtree is introduced.

[0071] Considering that each subtree root node may be determined to be the last subtree root node matching the target IP address, each subtree root node, except for the root node of the subtree root node set, is associated with a subtree. Furthermore, the direction of the subtree information includes first-direction subtree information and / or second-direction subtree information. In this embodiment, the routing value represented by the first-direction subtree information is 0, and the routing value represented by the second-direction subtree information is 1. Since the number and direction of the first-direction subtree information and / or second-direction subtree information for each subtree root node are uncertain, the length and direction of the formed subtree are also uncertain.

[0072] (4) Based on the root node of the tree, each root node of the two subtrees, the prefix and the subtree, establish the set of subtree root nodes.

[0073] In this embodiment of the application, the routing information table composed of the above-mentioned tree root node, each subtree root node in the two subtree root node strings, the prefix and the subtree is called the subtree root node set.

[0074] In existing technologies, the division method of subtree root nodes is usually fixed, that is, the number of prefixes between any two subtree root nodes is fixed. In the embodiments of this application, in order to meet the speed requirements, a lookup process can only access DRAM once. Since the maximum width of DRAM nodes is the same, that is, the equivalent data bus width Width is a fixed value. In order to achieve flexible division of subtree root nodes and subtrees, the following two types of data structures are proposed. Obviously, the contents defined by Type 1 and Type 2 are different. If the nodes in the subtree can be constructed according to Type 1 or Type 2, Type 1 and Type 2 can be converted at any time during the construction process. That is, a certain subtree is encoded and stored according to Type 1 or Type 2, and its length may be uncertain. If the subtree is constructed using Type 1, the length is greater than Width; if the subtree is constructed using Type 2, the length is less than Width. In this case, Type 2 is used to store the subtree, and vice versa. If using Type 2 still cannot guarantee that the length is less than Width, it is necessary to split the above-mentioned subtree, that is, to ensure that it does not exceed the maximum width of the DRAM node by constructing more subtrees. In this way, the length of the resulting subtrees is flexible, and the number of root nodes in the subtrees is minimized, thus meeting the needs of fast searching.

[0075] Additionally, it should be noted that if inserting a new routing table entry causes neither Type 1 nor Type 2 to have a length less than Width, then the subtree should be re-divided and a new subtree root node should be created.

[0076] Type 1

[0077]

[0078] Type 2

[0079]

[0080] After dividing the subtrees, the root nodes of each subtree are stored in SRAM, and each subtree is stored in DRAM.

[0081] After determining the set of subtree root nodes, the system first searches for the subtree root node that longest matches the target IP address within that set. This matching subtree root node is referred to as the target subtree root node. The system then searches the SRAM for the target subtree root node that matches the target IP address. (See [link to documentation]). Figure 3 As shown, it includes:

[0082] Step 2011: Align the starting path information of the target IP address with the root node of the subtree root node set pre-stored in SRAM.

[0083] Since a target routing table entry is a set of path information consisting of strings of uncertain length composed of several 0s and several 1s, in order to determine the routing table entry that matches the target IP address, it is necessary to search bit by bit from the first digit of the target IP address during the implementation process. During the implementation process, the starting path information of the target IP address is aligned with the root node of the subtree root node set pre-stored in SRAM, that is, the root node in SRAM is used as the starting point of the search process.

[0084] Step 2012: Based on the prefix connected to the root node of the Nth subtree, find the (N+1)th subtree root node that matches the first M bits of the target IP address, where N and M are natural numbers starting from 1.

[0085] During implementation, starting from the prefix connected to the root node, assuming that the path information is 2 bits each time, if the prefix between the root node and the second subtree root node matches the first 2 bits of the target IP address, then continue to check if the prefix between the second subtree root node and the third subtree root node matches the next 2 bits of the target IP address, and so on, until the N+1th subtree root node that matches the first M bits of the target IP address is found. That is, in the set of subtree root nodes, there is no matching N+2th subtree root node for the M+1th bit of the target IP address.

[0086] Step 2013: Determine the root node of the N+1th subtree as the root node of the target subtree.

[0087] Based on this, after determining the N+1th subtree root node that matches the first M bits of the target IP address, the N+1th subtree root node is determined as the target subtree root node.

[0088] Step 202: Determine the first target routing table entry based on the prefix of the root node of the target subtree. (See also...) Figure 4 As shown, it includes:

[0089] Step 2021: Determine the routing order of the prefix based on the root node, the Nth subtree root node, and the (N+1)th subtree root node.

[0090] Considering that there is a sequence among the root nodes of each subtree, the determined prefix information also has a sequence. During implementation, after determining the N+1th subtree root node, the routing order of the prefix is ​​determined according to the sequence of the first subtree root node, the second subtree root node, ..., the Nth subtree root node and the N+1th subtree root node.

[0091] That is, after the root node of the target subtree is determined, the first target routing table entry is determined based on the prefix corresponding to the root node of the tree and the root node of the target subtree.

[0092] Step 2022: Based on the routing order, combine the prefixes according to the routing values ​​represented by the first directional prefix and / or the second directional prefix, and determine the combined routing value as the first destination routing table entry.

[0093] After determining the above routing order, the prefixes are combined according to the routing order, that is, the prefixes are combined according to the routing values ​​represented by the first direction prefix information and / or the second direction prefix information, that is, the prefixes represented by 0 and / or 1. The combined routing values ​​are determined as the first destination routing table entry.

[0094] In the implementation process, the prefix corresponding to the root node of the target subtree is combined according to the routing values ​​represented by the first directional prefix and / or the second directional prefix, i.e., 0 and / or 1. The combined routing values ​​are then determined as the first target routing table entries.

[0095] Step 203: Based on the root node of the target subtree, search for the target subtree that matches the remaining IP addresses in the Dynamic Random Access Memory (DRAM). Determine the second target routing table entry based on the target subtree, where the remaining IP addresses are the portion of the target IP addresses excluding those matching the first target routing table entry. The root node of the target subtree includes at least one subtree, which represents the routing information included in the root node; the target subtree is one of the at least one subtrees.

[0096] During implementation, after determining the matching N+1th subtree root node in SRAM, the next step is to search for the target subtree matching the remaining IP addresses in DRAM. It should be noted that the aforementioned remaining IP addresses are the target IP addresses excluding those matching the first target routing table entry.

[0097] Considering that it's uncertain which subtree root node in the set of subtree root nodes is the (N+1)th matching subtree root node, the concept of a subtree is introduced to describe the portion that matches the remaining IP addresses. Each subtree root node, except for the tree root node, includes at least one subtree, which represents the routing information included in the corresponding current subtree root node. The target subtree root node includes at least one subtree, and this at least one subtree represents the routing information included in the target subtree root node.

[0098] Based on the root node of the target subtree, search the DRAM for the target subtree that matches the remaining IP addresses. Then, determine the second target routing table entry based on the target subtree. (See [link / reference]). Figure 5 As shown, it includes:

[0099] Step 2031: Locate the target subtree address in DRAM that corresponds to the memory address of the target subtree root node.

[0100] To facilitate subtree searching, the storage address of each subtree root node corresponds to the addresses of the subtrees included in that subtree root node. That is, there is a one-to-one correspondence between the storage address of the subtree root node and the subtree address (e.g., the addresses are the same). During implementation, after determining the matching N+1th subtree root node, i.e. the target subtree root node, the target subtree root node is searched in all addresses of DRAM for the target subtree address corresponding to the storage address of the target subtree root node.

[0101] Step 2032: Determine the subtree stored in the target subtree address as the target subtree that matches the remaining IP address.

[0102] After determining the target subtree address, the subtree stored in the target subtree address is identified as the target subtree that matches the remaining IP addresses. Typically, the storage address of the root node of the target subtree is consistent with the storage address of the corresponding target subtree. Furthermore, the routing information of the target subtree is matched bit by bit with the remaining IP addresses.

[0103] Step 2033: Based on the longest prefix matching algorithm, determine the routing information in the target subtree that matches the remaining IP addresses as the second target routing table entry.

[0104] During implementation, based on the longest prefix matching algorithm, routing information matching the remaining IP address is searched in the target subtree. If a left subtree (composed of first-direction subtree information and / or second-direction subtree information) or a right subtree (composed of first-direction subtree information and / or second-direction subtree information) matching the remaining IP address can be found in the target subtree, the aforementioned left subtree or right subtree is determined as the second target routing table entry. If no routing information matching the remaining IP address is found in the target subtree, the second target routing table entry is set to empty. The direction of the first subtree information of the left subtree is the first direction, and the direction of the first subtree information of the right subtree is the second direction.

[0105] It should be added that the routing value represented by the first directional subtree information is 0, and the routing value represented by the second directional subtree information is 1.

[0106] Step 204: Combine the first destination routing table entry and the second destination routing table entry to obtain a destination routing table entry that matches the destination IP address.

[0107] Specifically, the first and second destination routing table entries are combined to obtain a destination routing table entry that matches the destination IP address. (See [link to documentation]). Figure 6 As shown, it includes:

[0108] Step 2041: Determine the last route value in the first destination routing table entry.

[0109] Considering that the remaining IP address is the latter half of the target IP address, the second target routing table entry mentioned above needs to be connected after the first target routing table entry. Based on this, the last routing value in the first target routing table entry is determined first, that is, the last bit in the first target routing table entry is determined to be 0 or 1.

[0110] Step 2042: Connect the last routing value of the first destination routing table entry with the second destination routing table entry in series to obtain the first destination routing table entry and the second destination routing table entry after serial connection.

[0111] During implementation, after determining the last routing value, the last routing value is serially connected with the first routing value in the second target routing table entry, thus realizing the serial connection between the first target routing table entry and the second target routing table entry.

[0112] Step 2043: Determine the first and second destination routing table entries after serial connection as destination routing table entries that match the destination IP address.

[0113] The first and second destination routing table entries after the above serial connection are determined as destination routing table entries that match the destination IP address.

[0114] It should be noted that after determining the target routing table entry, the above also includes: determining and outputting the next-hop information corresponding to the target routing table entry.

[0115] In order for the target IP address to continue to be transmitted in the network, it is necessary to find the next hop information. In this embodiment of the application, the root node of the target subtree and the target subtree are both associated with the next hop information. After the target routing table entry is determined, the corresponding next hop information is further determined according to the root node of the target subtree or the target subtree. The process of finding the next hop information according to the target IP address and continuing to transmit is the same as the prior art, and will not be described in detail here.

[0116] See Figure 7 The set of subtree root nodes shown is used as an example to illustrate how to find the target IP 177.30.44.88.

[0117] The binary representation of the target IP address 177.30.44.88 is 10110001 000111100010110001011000. First, a matching target subtree root node is searched in SRAM. Based on the first bit of the IP address being 1, the subtree root node T3 connected to the root node with the second directional prefix is ​​checked. It is determined that T3's 10110001000 matches the first 11 bits of the target IP address. Based on the 12th bit of the IP address being 1, the search continues, checking the subtree root node T4 connected to the subtree root node T3 with the second directional prefix. It is determined that the prefix between T4 and the root node matches bits 0 to 18 of the target IP address, while the 19th bit of the target IP address no longer matches any subtree root node. Therefore, the target subtree root node is determined to be T4, and the first target routing table entry is determined to be 10110001 00011110 00.

[0118] Based on the target IP address and the first target routing table entry, the remaining IP address is determined to be 10110001011000. According to the root node T4 of the target subtree, the target subtree that matches the remaining IP address is searched in DRAM. That is, the remaining bits 1011000101 stored in DRAM match the first 10 bits of the remaining IP address. Based on the longest prefix matching algorithm, 1011000101 is determined as the second target routing table entry. Furthermore, the first target routing table entry and the second target routing table entry are combined to obtain the target routing table entry that matches the target IP address as 10110001 00011110 00101100 0101, and the next hop information corresponding to the target routing table entry is output as H.

[0119] Based on the same inventive concept, see [reference] Figure 8 As shown in the figure, this application provides an apparatus for looking up a routing table entry, comprising:

[0120] The first lookup unit 801 is used to look up the target subtree root node that matches the target IP address in the static random access memory (SRAM). The SRAM includes a set of subtree root nodes for indicating routing table entry information. The set of subtree root nodes includes multiple connected subtree root nodes. Each subtree root node includes a prefix. The length of the prefix of the multiple subtree root nodes is not fixed. The prefix of the target subtree root node is used to characterize the routing information between the target subtree root node and the root nodes of the set of subtree root nodes.

[0121] The determining unit 802 is used to determine the first target routing table entry based on the prefix of the root node of the target subtree;

[0122] The second lookup unit 803 is used to search for a target subtree that matches the remaining IP address in the dynamic random access memory (DRAM) based on the root node of the target subtree, and to determine a second target routing table entry based on the target subtree. The remaining IP address is the part of the target IP address that is not matched with the IP address in the first target routing table entry. The root node of the target subtree includes at least one subtree, and the at least one subtree is used to characterize the routing information included in the root node of the target subtree. The target subtree is one of the at least one subtree.

[0123] The combination unit 804 is used to combine the first destination routing table entry and the second destination routing table entry to obtain a destination routing table entry that matches the destination IP address.

[0124] Based on the same inventive concept, see [reference] Figure 9 As shown, this application embodiment provides a smart terminal, including: a memory 901 for storing executable instructions; and a processor 902 for reading and executing the executable instructions stored in the memory, and executing any of the methods described in the first aspect above.

[0125] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium that, when the instructions in the storage medium are executed by a processor, enables the processor to perform the method described in any of the first aspects above.

[0126] In summary, the embodiments of this application provide a method and apparatus for finding routing table entries. The method includes: searching for a target subtree root node in an SRAM that matches a target IP address, wherein the SRAM includes a set of subtree root nodes for indicating routing table entry information, the set of subtree root nodes includes multiple connected subtree root nodes, each of the multiple subtree root nodes includes a prefix, the length of the prefix of the multiple subtree root nodes is not fixed, the prefix of the target subtree root node is used to characterize the routing information between the target subtree root node and the root nodes of the set of subtree root nodes, determining a first target routing table entry based on the prefix of the target subtree root node, and searching for a target subtree root entry in the DRA based on the target subtree root node. In M, a target subtree matching the remaining IP address is searched. Based on the target subtree, a second target routing table entry is determined. The remaining IP address is the part of the target IP address that is not matched with the first target routing table entry. The root node of the target subtree includes at least one subtree, which is used to represent the routing information included in the root node of the target subtree. The target subtree is one of the at least one subtree. The first target routing table entry and the second target routing table entry are combined to obtain the target routing table entry matching the target IP address. The above method of storing routing information hierarchically in the root node and subtree facilitates quick and efficient retrieval of the routing table entry matching the target IP address.

[0127] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program product systems. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product system 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 code.

[0128] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program product systems according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0129] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0130] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0131] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method of looking up a routing table entry, characterized by, The method comprises: finding a target sub-tree root node matching a target IP address in a static random access memory (SRAM), wherein the SRAM comprises a sub-tree root node set for indicating routing table item information, the sub-tree root node set comprises a plurality of sub-tree root nodes connected in series, each of the plurality of sub-tree root nodes comprises a prefix, the length of the prefix of the plurality of sub-tree root nodes is not fixed, and the prefix of the target sub-tree root node is used to represent routing information between the target sub-tree root node and a tree root node of the sub-tree root node set; determining a first target routing table item based on the prefix of the target sub-tree root node; based on the target sub-tree root node, finding a target sub-tree matching a remaining IP address in a dynamic random access memory (DRAM), determining a second target routing table item based on the target sub-tree, wherein the remaining IP address is the remaining part of the target IP address except the IP address consistent with the first target routing table item; the target sub-tree root node comprises at least one sub-tree, the at least one sub-tree is used to represent the routing information included in the target sub-tree root node; and the target sub-tree is one of the at least one sub-tree; combining the first target routing table item and the second target routing table item to obtain a target routing table item matching the target IP address.

2. The method of claim 1, wherein, The method further comprises establishing the sub-tree root node set; the establishment of the sub-tree root node set comprises: connecting the tree root node with two sub-tree root node strings, wherein each of the sub-tree root node strings comprises a plurality of sub-tree root nodes connected in series; connecting each of the sub-tree root nodes except the tree root node of the sub-tree root node set with the previous sub-tree root node through the prefix, wherein the prefix comprises a first direction prefix and / or a second direction prefix, the routing value represented by the first direction prefix is 0, and the routing value represented by the second direction prefix is 1; associating each of the sub-tree root nodes except the tree root node of the sub-tree root node set with at least one sub-tree, wherein each of the sub-trees comprises first direction sub-tree information and / or second direction sub-tree information, the routing value represented by the first direction sub-tree information is 0, and the routing value represented by the second direction sub-tree information is 1; establishing the sub-tree root node set based on the tree root node, each of the sub-tree root nodes in the two sub-tree root node strings, the prefix, and the sub-trees.

3. The method of claim 2, wherein, The method of finding a target sub-tree root node matching a target IP address in a static random access memory (SRAM) comprises: aligning the starting path information of the target IP address with the tree root node of the sub-tree root node set stored in the SRAM in advance; finding an N+1th sub-tree root node matching the target IP address based on the prefix connected with the Nth sub-tree root node, wherein N is a natural number starting from 1; determining the N+1th sub-tree root node as the target sub-tree root node.

4. The method of claim 3, wherein, The first target routing table item is determined based on the prefix of the target sub-tree root node, including: The routing order of the prefix is determined based on the tree root node, the Nth sub-tree root node and the N+1th sub-tree root node; The prefix is combined according to the routing value represented by the first direction prefix and / or the second direction prefix based on the routing order, and the combined routing value is determined as the first target routing table item.

5. The method of claim 2, wherein, The second target routing table item is determined based on the target sub-tree matched with the remaining IP address found in the DRAM based on the target sub-tree root node, including: The target sub-tree address corresponding to the storage address of the target sub-tree root node is found in the DRAM; The sub-tree stored in the target sub-tree address is determined as the target sub-tree matched with the remaining IP address; The routing information in the target sub-tree matched with the remaining IP address is determined as the second target routing table item based on the longest prefix matching algorithm.

6. The method of claim 1, wherein, The first target routing table item and the second target routing table item are combined to obtain the target routing table item matched with the target IP address, including: The last routing value in the first target routing table item is determined; The last routing value of the first target routing table item is serially connected with the second target routing table item to obtain the serially connected first target routing table item and second target routing table item; The serially connected first target routing table item and second target routing table item are determined as the target routing table item matched with the target IP address.

7. The method of claim 1, wherein, The method further includes: The next hop information corresponding to the target routing table item is determined and output.

8. An apparatus for searching a routing table entry, the apparatus comprising: It includes: The first finding unit is used for finding the target sub-tree root node matched with the target IP address in the static random access memory (SRAM), wherein the SRAM includes a sub-tree root node set for indicating routing table item information, the sub-tree root node set includes a plurality of connected sub-tree root nodes, each sub-tree root node in the plurality of sub-tree root nodes includes a prefix, the length of the prefix of the plurality of sub-tree root nodes is not fixed, and the prefix of the target sub-tree root node is used to represent the routing information between the target sub-tree root node and the tree root node of the sub-tree root node set; The determination unit is used for determining the first target routing table item based on the prefix of the target sub-tree root node; The second finding unit is used for finding the target sub-tree matched with the remaining IP address in the dynamic random access memory (DRAM) based on the target sub-tree root node, and determining the second target routing table item based on the target sub-tree, wherein the remaining IP address is the remaining part of the target IP address except the IP address consistent with the first target routing table item; the target sub-tree root node includes at least one sub-tree, the at least one sub-tree is used to represent the routing information included by the target sub-tree root node; and the target sub-tree is one of the at least one sub-tree. The combination unit is used to combine the first target routing table entry and the second target routing table entry to obtain a target routing table entry that matches the target IP address.

9. A smart terminal, characterized in that include: Memory, used to store executable instructions; A processor for reading and executing executable instructions stored in the memory to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor, the processor is able to perform the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Trie stage balancing for network address lookup

    CN105814846A

  • Large-scale character string high-speed searching method based on TCAM

    CN107967219A