WO2015032214A1 - High-speed routing lookup method and device simultaneously supporting ipv4 and ipv6 - Google Patents

High-speed routing lookup method and device simultaneously supporting ipv4 and ipv6 Download PDF

Info

Publication number
WO2015032214A1
WO2015032214A1 PCT/CN2014/077912 CN2014077912W WO2015032214A1 WO 2015032214 A1 WO2015032214 A1 WO 2015032214A1 CN 2014077912 W CN2014077912 W CN 2014077912W WO 2015032214 A1 WO2015032214 A1 WO 2015032214A1
Authority
WO
WIPO (PCT)
Prior art keywords
ipv6
ipv4
node
route
lookup
Prior art date
Application number
PCT/CN2014/077912
Other languages
French (fr)
Chinese (zh)
Inventor
程晨
李彧
张炜
白栎旸
徐宝魁
王晓明
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2015032214A1 publication Critical patent/WO2015032214A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/64Hybrid switching systems
    • H04L12/6418Hybrid transport

Definitions

  • the present invention relates to the field of network switching technologies, and in particular, to a method and apparatus for high-speed route searching based on B-Tree and supporting both IPv4 and IPv6.
  • BACKGROUND OF THE INVENTION With the rapid development of the Internet on the Internet, the core routers used for backbone network interconnection have an interface rate of up to 100 Gbps, which requires the core router to achieve a route lookup rate of several million times per second while supporting a large-capacity routing table.
  • IP search needs to get the longest matching prefix. IPv6 is much larger than IPv4 address space. It requires higher storage and search speed. In recent years, researchers have proposed a variety of hardware search methods to improve the search rate, which is most popular with Trie tree structure and TCAM. .
  • the Trie tree structure is the most widely used tree structure, and it is easy to implement pipeline operations on hardware, which is beneficial to improve the throughput of route lookup.
  • the Trie tree structure has certain limitations. Generally, the Trie tree structure has a large number of pipeline stages, which causes an excessive search delay.
  • the route lookup design using a multi-bit Trie tree structure can greatly reduce the number of pipeline stages, but it will bring a lot of extra memory consumption, and this extra memory consumption is related to the prefix distribution of the routing table, so that the multi-bit Trie tree is based. There is a large ups and downs in the routing table capacity of the route lookup hardware design. In particular, because the key value width difference between IPv4 and IPv6 is 4 times, it is difficult for the same hardware architecture to support IPv4 and IPv6 route lookup at the same time, which increases the complexity and cost of hardware design.
  • TCAM can implement IPv4 and IPv6 route lookup in the same chip, but to meet the lOOGbps search rate and the core router's routing table capacity requirements, multiple TCAM cascaded lookups are required, and power consumption and heat generation will become serious problems.
  • B-tree is a software algorithm widely used in database file management. It is characterized by a tree node with M-1 keywords and M child nodes. The depth of B-Tree is determined by the order M and the number of keywords. Decision, regardless of the distribution of keywords.
  • the present invention proposes a method and apparatus capable of simultaneously performing IPv4 and IPv6 route lookup.
  • An object of the embodiments of the present invention is to provide a high-speed route search method and apparatus for supporting both IPv4 and IPv6.
  • a high-speed route search method for supporting both IPv4 and IPv6 including the following steps: Responding to a route entry update command sent by a route forwarding system in real time, and saving the IPv4 and IPv6 shared tree nodes The routing entry information is updated.
  • the route lookup it is determined whether an IPv4 route lookup or an IPv6 route lookup is required according to the route lookup request. If it is determined that an IPv4 route lookup is required, the IPv4 and IPv6 shared tree structure is used to find an IPv4 route lookup. An IPv4 root node, and obtains IPv4 routing information from respective nodes of the shared tree structure according to a pipeline search manner from an IPv4 root node; if it is determined that an IPv6 route lookup is required, the IPv4 and IPv6 shared tree structure is used to find an IPv6 route.
  • the IPv6 root node is searched, and IPv6 routing information is obtained from each corresponding node of the shared tree structure according to a pipeline search manner from the IPv6 root node.
  • the IPv4 and IPv6 routing tables are stored in the B-Tree node of the same bit width, and the IPv4 routing table and the IPv6 routing table dynamically share the multi-layer nodes, and each layer node stores multiple routing information.
  • the memory area stores: an IPv4 root node address, an IPv6 root node address, the multi-layer node, and a result table.
  • obtaining the IPv4 routing information includes:
  • the IPv4 lookup logic obtains an IPv4 key value from the route lookup request, and obtains an IPv4 root node address from the memory area;
  • the IPv4 lookup logic uses the IPv4 root node address to find the IPv4 root node from the IPv4 and IPv6 shared tree structure, reads and parses the node data of the node, finds the routing information of the node, and searches the routing information of the next-level node according to the pipeline search mode. Until the routing information of the last-level node is found; wherein the IPv4 search logic obtains the next-level node pointer by comparing the IPv4 key value with the route prefix in the node data of each node being parsed, and Corresponding IPv4 routing information is obtained in the matched routing entry data.
  • obtaining the corresponding IPv4 routing information from each matched routing entry data comprises: saving a result table entry pointer in each matching routing entry in a cache of the searching module; a result table entry of the routing entry matching each level of the pipeline The pointer directly covers the contents of the cache; after ending the route lookup for all nodes, the result table is searched according to the final result table entry pointer in the cache to obtain the corresponding IPv4 routing information.
  • obtaining the IPv6 routing information includes:
  • the IPv6 lookup logic obtains an IPv6 key value from the route lookup request, and obtains an IPv6 root node address from the memory area;
  • the IPv6 lookup logic uses the IPv6 root node address to find the IPv6 root node from the IPv4 and IPv6 shared tree structure. By reading and parsing the node data of the node, the routing information of the node is found, and the routing information of the next-level node is searched according to the pipeline searching manner. Until the routing information of the last-level node is found; wherein the IPv6 search logic compares the IPv6 key value with the route prefix in the node data of each node that is parsed, respectively, to obtain the next-level node pointer, and Corresponding IPv6 routing information is obtained in the matched routing entry data.
  • obtaining the corresponding IPv6 routing information from each matched routing entry data includes: saving a result table entry pointer in each matched routing entry in a cache of the searching module; a result table entry of the routing entry matching each level of the pipeline The pointer directly covers the contents of the cache; After the route lookup is completed for all nodes, the result table is searched according to the final result table entry pointer in the cache, and the corresponding IPv6 routing information is obtained.
  • a high-speed route finder device for supporting both IPv4 and IPv6
  • a route entry information update module configured to respond to a route entry update command sent by a route forwarding system in real time, to IPv4
  • the route entry information saved by the IPv6 shared tree node is updated
  • the route lookup module is determined to be configured to determine whether an IPv4 route lookup or an IPv6 route lookup is required according to the route lookup request during the route lookup request;
  • the IPv4 route lookup module is configured to: when it is determined that an IPv4 route lookup is required, find an IPv4 root node for IPv4 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv4 root node according to the pipeline search manner from the shared tree structure. Each corresponding node obtains IPv4 routing information;
  • the IPv4 result obtaining module is configured to look up the IPv4 routing information search result table obtained by the IPv4 route lookup module to obtain an actual IPv4 route search result.
  • the IPv6 route lookup module is configured to: when it is determined that an IPv6 route lookup is required, find an IPv6 root node for IPv6 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv6 root node according to the pipeline search manner from the shared tree structure. Each corresponding node obtains IPv6 routing information.
  • the IPv6 result obtaining module is configured to look up the IPv6 routing information search result obtained by the IPv6 route lookup module to obtain the actual IPv6 route search result.
  • the IPv4 route lookup module includes: an IPv4 acquisition unit, configured to obtain an IPv4 key value from the route lookup request by using an IPv4 lookup logic, and obtain an IPv4 root node address from the memory area;
  • the IPv4 search unit is set to use the IPv4 root node address to find the IPv4 root node from the IPv4 and IPv6 shared tree structure by using the IPv4 root node address, and by reading and parsing the node data of the node, searching for the routing information of the node, and searching according to the pipeline search manner. Routing information of the first-level node until the routing information of the last-level node is searched; wherein the IPv4 search logic compares the IPv4 key value with the route prefix in the node data of each node that is parsed to obtain the next level. The node pointer, and obtain corresponding IPv4 routing information from each matched routing entry data.
  • the IPv6 route lookup module includes:
  • An IPv6 obtaining unit configured to obtain an IPv6 key value from the route lookup request by using an IPv6 lookup logic, and obtain an IPv6 root node address from the memory area;
  • the IPv6 search unit is set to the IPv6 lookup logic to find the IPv6 root node from the IPv4 and IPv6 shared tree structure by using the IPv6 root node address, and by reading and parsing the node data of the node, searching for the routing information of the node, and searching according to the pipeline search manner. Routing information of the first-level node until the routing information of the last-level node is found; wherein the IPv6 search logic compares the IPv6 key value with the route prefix in the node data of each node that is parsed to obtain the next level. The node pointer, and obtain corresponding IPv6 routing information from each matched routing entry data.
  • FIG. 1 is a flowchart of a high-speed route searching method for supporting both IPv4 and IPv6 according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a high-speed route searching device for supporting both IPv4 and IPv6 according to an embodiment of the present invention
  • 3 is a block diagram of a device for performing IPv4 and IPv6 route lookup according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of a structure of IPv4 and IPv6 tree structure according to an embodiment of the present invention
  • FIG. 6 is a block diagram of a function module of a route lookup hardware module according to an embodiment of the present invention
  • FIG. 7 is a flowchart of a route lookup hardware module search according to an embodiment of the present invention
  • FIG. 8 is a prefix provided by an embodiment of the present invention
  • Schematic Schematic.
  • FIG. 1 is a flowchart of a high-speed route search method for supporting both IPv4 and IPv6 according to an embodiment of the present invention. As shown in FIG. 1, the method includes the following steps: Step S101: Respond to a route entry update command sent by a route forwarding system in real time.
  • Step S102 determining, during the route searching, whether the IPv4 route search or the IPv6 route search is performed according to the route lookup request;
  • Step S103 If it is determined that an IPv4 route lookup is required And searching for an IPv4 root node for IPv4 route lookup from the IPv4 and IPv6 shared tree structure, and obtaining IPv4 routing information from each corresponding node of the shared tree structure according to a pipeline search manner from the IPv4 root node;
  • Step S104 An IPv6 route lookup is required, and an IPv6 root node for IPv6 route lookup is searched from the IPv4 and IPv6 shared tree structure, and IPv6 routing information is obtained from each corresponding node of the shared tree structure according to a pipeline search manner from the IPv6 root node.
  • the IPv4 and IPv6 routing tables are stored in the B-Tree node of the same bit width.
  • the IPv4 routing table and the IPv6 routing table dynamically share the multi-layer nodes, and each layer node stores multiple routing information.
  • the memory area stores: an IPv4 root node address, an IPv6 root node address, the multi-layer node, and a result table.
  • Obtaining the IPv4 routing information in the embodiment of the present invention includes: the IPv4 search logic acquires an IPv4 key value from the route lookup request, and obtains an IPv4 root node address from the memory area; the IPv4 lookup logic uses the IPv4 root node address to share from the IPv4 and the IPv6.
  • the tree structure finds the IPv4 root node, finds and analyzes the node data of the node, finds the routing information of the node, and searches the routing information of the next-level node according to the pipeline searching manner, until the routing information of the last-level node is found;
  • the IPv4 lookup logic obtains the next-level node pointer by comparing the IPv4 key value with the route prefix in the node data of each node that is parsed, and obtains corresponding IPv4 routing information from each matched route entry data.
  • the IPv4 route prefix in the node includes a VPN, an IPv4 prefix, and an IPv4 prefix vector (Vector).
  • Each bit of the IPv4 prefix vector indicates a prefix length of the prefix, if one of them If the bit is ', the prefix with the corresponding length of the bit exists in the prefix.
  • multiple IPv4 route prefixes with different parent lengths can be stored in the same IPv4 prefix.
  • obtaining the corresponding IPv4 routing information from each matched routing entry data comprises: storing a result table entry pointer in each matching routing entry in a cache of the searching module; a result table entry of the routing entry matching each level of the pipeline The pointer directly covers the contents of the cache; after ending the route lookup for all nodes, the result table is searched according to the final result table entry pointer in the cache to obtain the corresponding IPv4 routing information.
  • Obtaining the IPv6 routing information in the embodiment of the present invention includes: the IPv6 search logic acquires an IPv6 key value from the route lookup request, and obtains an IPv6 root node address from the memory area; the IPv6 lookup logic uses the IPv6 root node address to share from IPv4 and IPv6.
  • the tree structure finds the IPv6 root node, finds and analyzes the node data of the node, finds the routing information of the node, and searches the routing information of the next-level node according to the pipeline searching manner, until the routing information of the last-level node is found;
  • the IPv6 lookup logic obtains the next-level node pointer by comparing the IPv6 key value with the route prefix in the node data of each node that is parsed, and obtains corresponding IPv6 routing information from each matched route entry data.
  • the IPv6 route prefix in the node includes a VPN, an IPv6 prefix, and an IPv6 prefix vector (Vector). Each bit of the IPv6 prefix vector indicates a prefix length of the prefix.
  • obtaining the corresponding IPv6 routing information from each matched routing entry data includes: saving a result table entry pointer in each matched routing entry in a cache of the searching module; a result table entry of the routing entry matching each level of the pipeline The pointer directly covers the contents of the cache; after ending the route lookup for all nodes, the result table is searched according to the final result table entry pointer in the cache to obtain the corresponding IPv6 routing information.
  • FIG. 2 is a schematic diagram of a high-speed route finder device for supporting both IPv4 and IPv6 according to an embodiment of the present invention. As shown in FIG. 2, the method includes: a route entry information update module 201, configured to respond to a route delivered by a route forwarding system in real time.
  • a route entry information update module 201 configured to respond to a route delivered by a route forwarding system in real time.
  • An entry update command updating routing entry information saved by the IPv4 and IPv6 shared tree nodes; determining a route lookup module 202, configured to determine whether an IPv4 route lookup or an IPv6 route lookup is required according to the route lookup request during the route lookup; IPv4 route The searching module 203 is configured to: when determining that an IPv4 route lookup is required, find an IPv4 root node for IPv4 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv4 root node according to the pipeline search manner from the shared tree structure.
  • the IPv6 routing information module is configured to: when it is determined that an IPv6 route lookup is required, find an IPv6 root node for IPv6 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv6 root node according to the pipeline search manner. Each corresponding node of the shared tree structure obtains IPv6 routing information.
  • the embodiment of the present invention further includes: an IPv4 result obtaining module 205, configured to perform an IPv4 routing information search result table obtained by the IPv4 route search module, and obtain an actual IPv4 route search result; the IPv6 result obtaining module 206 is set to In the IPv6 route lookup, the IPv6 route information lookup result table obtained by the IPv6 route lookup module is obtained, and the actual IPv6 route search result is obtained.
  • an IPv4 result obtaining module 205 configured to perform an IPv4 routing information search result table obtained by the IPv4 route search module, and obtain an actual IPv4 route search result
  • the IPv6 result obtaining module 206 is set to In the IPv6 route lookup, the IPv6 route information lookup result table obtained by the IPv6 route lookup module is obtained, and the actual IPv6 route search result is obtained.
  • the IPv4 route lookup module 203 includes: an IPv4 acquisition unit, configured to obtain an IPv4 key value from the route lookup request, and obtain an IPv4 root node address from the memory area; and an IPv4 search unit, set to an IPv4 lookup The logic uses the IPv4 root node address to find the IPv4 root node from the IPv4 and IPv6 shared tree structure, reads and parses the node data of the node, finds the routing information of the node, and searches the routing information of the next-level node according to the pipeline search manner until Finding routing information of the last-level node; wherein the IPv4 search logic obtains the next-level node pointer by comparing the IPv4 key value with the route prefix in the node data of each node that is parsed, and The corresponding IPv4 routing information is obtained in the routing entry data.
  • the IPv6 route lookup module 204 includes: an IPv6 obtaining unit, configured to obtain an IPv6 key value from the route lookup request by using
  • the IPv6 search unit is set to the IPv6 lookup logic to find the IPv6 root node from the IPv4 and IPv6 shared tree structure by using the IPv6 root node address, and by reading and parsing the node data of the node, searching for the routing information of the node, and searching according to the pipeline search manner. Routing information of the first-level node until the routing information of the last-level node is found; wherein the IPv6 search logic compares the IPv6 key value with the route prefix in the node data of each node that is parsed to obtain the next level. The node pointer, and obtain corresponding IPv6 routing information from each matched routing entry data.
  • the method includes a route lookup algorithm software module 301, a route update interface module 302, and a route lookup hardware module 303.
  • the route search algorithm software module 301 completes the software calculation and update entry instruction delivery of the route entry.
  • the route update interface module 302 searches the actual working state of the hardware module 303 according to the route, and controls the route lookup.
  • the data stream of the hardware module 303 is written into the memory of the route lookup hardware module 303; the route lookup hardware module 303 is a two-way parallel pipelined architecture that responds to the hardware system's IPv4 and IPv6 route lookup requests and returns The longest prefix matches the search result.
  • the route lookup algorithm software module 301 runs on the main control CPU, and may be a B-Tree algorithm software program written in a high-level algorithm language (such as C, C++ language) to calculate and update the hardware routing table.
  • the route update interface module 302 is a hardware module, which includes a buffer area and a logical processing area. The buffer area is used to store the update node information written by the route lookup algorithm software module 301.
  • the logic processing area is configured to search the related state of the hardware module 303 according to the route, and write the update node data into the route lookup hardware module 303 according to a certain order.
  • the route lookup hardware module 303 is the main module of hardware route lookup, and is a pipeline design mainly composed of an IPv4 lookup logic area, an IPv6 lookup logic area, and a memory area.
  • the IPv4 and IPv6 lookup logic respectively processes the corresponding lookup requests and returns the search results.
  • the memory area is also a hierarchical structure for storing node data of IPv4 and IPv6.
  • the specific implementation method of the present invention is mainly divided into three parts: tree structure design, software module design and hardware module design. FIG.
  • the tree structure design of the present invention is to determine the node width of the IPv4 and IPv6 nodes, and the tree structure orders M1 and M2.
  • the structure design needs to comprehensively consider the basic data bit width of IPv4 and IPv6, the maximum requirements of the routing table, the cost of reading and writing hardware memory, hardware layout and other factors.
  • IPv4 and IPv6 route lookups are implemented by two pipeline lookup logics, but their tree node storage space is shared, and IPv4 and IPv6 nodes of the same pipeline level are stored in the same memory address space.
  • the tree structure generated by IPv4 and IPv6 can be as shown in Figures 401 and 402, since each key-value width of IPv4 is 32-bit, and each of IPv6 The key-value width is 128-bit, so under the same bit-width node data structure, the order M1 of the B-Tree of IPv4 is greater than the order M2 of IPv6 (the tree node of IPv4 can index more child nodes).
  • the tree shape of IPv4 is short and fat, and the tree shape of IPv6 is high and thin. If you simply add two routing tables, the memory requirement is a simple sum of the two tree areas, and their hardware design will be independent of each other.
  • the design of the embodiment of the present invention is as shown in FIG. 403. The two trees are merged, and the bottoms of the trees are at the same level. The tree nodes of each level are determined by their respective maximum demands, and the maximum number of levels is determined by the tree height of IPv6. Decide.
  • FIG. 5 is a block diagram showing the function modules of the route lookup algorithm software module provided by the embodiment of the present invention. As shown in FIG. 5, the entire routing algorithm software module is implemented based on the B-Tree algorithm, and the overall framework is divided into four parts: the IPv4 algorithm module 501 The IPv6 algorithm module 502, the memory management module 503, and the update hardware operation module 504.
  • the IPv4 algorithm module architecture 501 includes two parts: an insert operation module and a delete operation module.
  • the main operation of the insert operation module is to respond to the route insert instruction of the route forwarding system, and insert the delivered route entry into the B-Tree tree structure.
  • the main operation of the delete operation module is to respond to the route deletion instruction of the route forwarding system, and delete the delivered route entry from the B-Tree tree structure.
  • the IPv4 algorithm module 501 and the IPv6 algorithm module 502 use the same algorithm, which are both B-Tree-based route lookup algorithms, except that the bit width of the key value and the order of the B-Tree are different.
  • the function of the memory management module 503 is to manage the node data memory and the result table data memory in the route lookup algorithm, wherein the space of the IPv4 and IPv6 nodes and the result table are uniformly allocated by the management function, that is, the nodes of the IPv4 and the IPv6.
  • the result tables are allocated in the same resource pool, enabling them to share resources with each other and improve the adaptability of the search device.
  • the primary function of the update hardware operation module 504 is to update tree nodes and result table entries in hardware memory.
  • the update hardware operation module 504 records all the information that needs to be updated in the cache; then, after inserting the operation module or deleting the operation module, converting the tree node from the software data format to the agreed hardware data format; finally, the converted hardware
  • the data and the corresponding hardware mapped address can be continuously written into the route update interface module through the software and hardware interaction interface, but not limited to the LocalBus or PCIe interface.
  • the significance of the update hardware operation module 504 is to reduce the interface interaction of the hardware and software, save the update time, and reduce the impact of the item update on the actual hardware lookup flow.
  • FIG. 6 is a block diagram showing the function module of the route lookup hardware module provided by the embodiment of the present invention. As shown in FIG.
  • the route update interface module 601 and the route lookup hardware module 604 are included.
  • the route update interface module 601 includes a buffer area 602 and a logical processing area 603.
  • the main function of the buffer area 602 is to receive the node data written by the storage software through the software and hardware interaction interface, the result table entry data and their corresponding hardware addresses, which have been converted into hardware data formats by software.
  • the main function of the logical processing area 603 is to update the tree node and the result table entry data in the hardware memory under the condition that the correctness of the normal search is not affected.
  • the main function of the route lookup hardware module 604 is to implement IPv4 and IPv6 routing hardware lookup functions, including IPv4 lookup logic 605, IPv6 lookup logic 606, memory area 607, instruction dispatch 609, and result aggregation 610.
  • the main function of the IPv4 lookup logic 605 is to complete the IPv4 route lookup and return the IPv4 route lookup result.
  • the IPv4 lookup pipeline has a total of N1+1 levels, where LV_1 to LV_N1 are tree node lookup logic layers, and LV_N1+1 is a result table lookup logic layer. Each search logic layer corresponds to a separate memory space in the memory area, ensuring that the accesses of the layers to the memory area do not conflict with each other.
  • the main function of the IPv6 lookup logic 606 is to complete the IPv6 route lookup and return the IPv6 route lookup result.
  • the IPv6 lookup pipeline has a total of N2+1 levels, where LV_1 to LV_N2 are tree node lookup logic layers, and LV_N2+1 is a result table lookup logic layer.
  • Each search logic layer corresponds to a separate memory space in the memory area, ensuring that the accesses of the layers to the memory area do not conflict with each other.
  • the memory area 607 is a data storage area in the route lookup hardware module, and each memory area in the memory area is independent of each other, and is divided into a root node address area, each layer node area, and a result table area.
  • the root node address 608 includes an IPv4 root node address and an IPv6 root node address for respectively storing the addresses of the root nodes of the B_Tree tree structure of IPv4 and IPv6.
  • Each layer of the tree node area is independent of each other and does not overlap with other layer tree node areas, so as to avoid conflicts in the simultaneous access of the pipeline.
  • the resulting table area is also a separate area accessed by the last level of the search flow.
  • the lookup pipeline bottom layer is at the same level, but the upper layer may have different IPv6 pipeline stages than the IPv6 pipeline level due to the characteristics of the IPv4 tree structure and the IPv6 tree structure.
  • the N1+1-level pipeline and the N2+1-level pipeline are respectively configured. Therefore, the sequence between the IPv4 and IPv6 route lookup requests is not guaranteed in the design of the embodiment of the present invention, and only the order between the IPv4 request and the IPv4 request is guaranteed. And the ordering between IPv6 requests and IPv6 requests.
  • the number of levels of the lookup pipeline is different, there are cases where the IPv4 lookup logic 605 and the IPv6 lookup logic 606 simultaneously access the same layer node in the memory area. This situation can be solved by a variety of methods, such as dual-port RAM with two sets of read-write ports in the memory RAM selection; logical scheduling can also be used to schedule read requests for lookup logic.
  • FIG. 7 is a flowchart of searching for a route lookup hardware module according to an embodiment of the present invention. As shown in FIG. 7, the method includes the following steps: Step S701: The route lookup hardware module receives the input search request. Step S702: The input search request search key value is distributed, the IPv4 request is sent to the IPv4 search logic, and the IPv6 request is sent to the IPv6 check logic.
  • Step S703 The search key value information and the root node address information in the memory area are simultaneously sent to the first level search stream;
  • Step S704 In the logic of the pipeline, first determine whether the root node address is the current level node, if it is the current level node , initiating a read node request to the memory, waiting for the memory to return the node data; if not the current level node, not requesting to the memory, leaving the current node information unchanged; step S705: parsing the obtained node information, and the key value If the node is not accessed, the analysis comparison is not required, and the waiting is performed; Step S706: If there is a hit, the result of the comparison is recorded, and the result corresponding to the hit route entry is recorded, and the result of the previous hit is overwritten; If the node of the level is not accessed, no recording is required, and the beating waits; Step S70 7: If a comparison is made, the node address that should be accessed by the next level is recorded in the node
  • FIG. 8 is a schematic diagram of a prefix structure provided by an embodiment of the present invention.
  • an IPv4 prefix structure 801 an IPv6 prefix structure 802, an IPv4 node pointer 20-bit 803, and an IPv6 node pointer 20-bit 804 are included.
  • Each IPv4 prefix structure 801 includes: a 32-bit prefix, a 16-bit VPN, and a 24-bit result supports more than 16M routing tables.
  • the 26-bit Vector does not have an IPv4 prefix with a prefix length of 1_7 in the actual routing table. . So the bit width required for the IPv4 prefix structure is 98-bit.
  • Each IPv6 prefix structure 802 includes a 128-bit prefix, a 16-bit VPN, and a 24-bit result supports a routing table of more than 16M.
  • the 114-bit Vector does not have an IPv6 prefix with a prefix length of 1_15 in the actual routing table. . So the bit width of the required IPv6 prefix structure is 282-bit.
  • Both IPv4 and IPv6 node pointers are 20-bit, which satisfies a large-scale tree structure. Then the data bit width of each layer node is A*M+B*M+1. Where A is the bit width of the prefix structure, M is the number of prefix structures, and B is the bit width of the node pointer. Since most of the tree nodes may be stored on the DDR, the access data bit width of the DDR is an integer multiple of 128-bit, so the data bit width of each layer node is preferably an integer multiple of 128. Then A1*M1+20*M2+1 128N, A2*M2+20*M2+1 128N are required. A1 is the prefix structure width of IPv4, A2 is the IPv6 prefix structure bit width, and Ml and M2 are the number of IPv4 and IPv6 prefixes in each layer node respectively. The values that can be selected are:
  • the IPv4 node requirement bit width is 964_bit
  • the IPv6 requirement bit width is 926-bit
  • the actually allocated node bit width is 1024-bit.
  • the number of pipelines under the large capacity requirement is small, the DDR performance is generally required, and the wasted memory is small. It can be expected that in this configuration, the 4M capacity IPv4 routing table and the 1M capacity IPv6 routing table requirement are required, and 11 levels of pipeline water and 600 Mb of node memory space are required. You can also choose a value that is:
  • the data format of the embodiment of the present invention is mainly divided into a node data format and a result table data format.
  • the node data includes: key value, tag vector, result table address, and next level pointer.
  • the key value is the route prefix in the routing table;
  • the tag vector is a tag vector in the B-Tree algorithm that marks different prefix length entries in the same prefix;
  • the table address is the address information of the result list corresponding to the routing entry in the result table;
  • the next level pointer is the node address that should be accessed by the next level after the level search.
  • the IPv4 B-Tree node and the IPv6 node have the same node bit width, and the tree nodes of the same pipeline level are stored in the same memory address space, and are distinguished by different node resolution logics of IPv4 and IPv6.
  • the hardware lookup structure designed in the embodiment of the present invention is a bottom-up B-Tree tree structure.
  • the embodiment of the invention designs the software algorithm module, the hardware data structure, the update process, the search pipeline structure and the memory structure of the route lookup system as a whole, and can simultaneously satisfy the route lookup of IPv4 and IPv6, and satisfy the high performance search of the large-capacity routing table. demand.
  • the embodiments of the present invention have the following technical effects:
  • the embodiments of the present invention can support large-scale IPv4 and IPv6 routing tables, and can simultaneously satisfy the high-speed route searching requirements of IPv4 and IPv6 in the core router, and bring convenience to the user. And improve the user experience.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Disclosed are a high-speed routing lookup method and device simultaneously supporting IPv4 and IPv6, which relate to the technical field of network switching. The device comprises three parts, i.e. a routing lookup algorithm software module, a routing update interface module and a routing lookup hardware module, wherein the routing lookup algorithm software module completes software calculations and update entry instruction issuance for a routing entry; after receiving a software update entry instruction, the routing update interface module controls a data stream of the routing lookup hardware module according to the actual operating state of the routing lookup hardware module, and writes an update entry into a memory of the routing lookup hardware module; and the routing lookup hardware module is in a two-way parallel pipelined architecture, respectively responds to IPv4 and IPv6 routing lookup requests of a hardware system, and returns a lookup result of the longest prefix match.

Description

一种同时支持 IPv4和 IPv6的高速路由查找方法及装置 技术领域 本发明涉及网络交换技术领域, 尤其涉及一种基于 B-Tree同时支持 IPv4和 IPv6 的高速路由查找方法及装置。 背景技术 随着因特网 Internet 的迅猛发展, 用于主干网络互联的核心路由器的接口速率达 到 lOOGbps, 该速率要求核心路由器在支持大容量路由表的情况下路由查找速率达到 每秒几百万次。  TECHNICAL FIELD The present invention relates to the field of network switching technologies, and in particular, to a method and apparatus for high-speed route searching based on B-Tree and supporting both IPv4 and IPv6. BACKGROUND OF THE INVENTION With the rapid development of the Internet on the Internet, the core routers used for backbone network interconnection have an interface rate of up to 100 Gbps, which requires the core router to achieve a route lookup rate of several million times per second while supporting a large-capacity routing table.
IP查找需要得到最长匹配前缀, IPv6远大于 IPv4的地址空间对于存储与查找速 度要求更高, 近年来研究人员提出了多种硬件查找方法以提高查找速率, 其中以 Trie 树结构和 TCAM最为流行。 IP search needs to get the longest matching prefix. IPv6 is much larger than IPv4 address space. It requires higher storage and search speed. In recent years, researchers have proposed a variety of hardware search methods to improve the search rate, which is most popular with Trie tree structure and TCAM. .
Trie树结构是应用最为广泛的树结构, 容易实现硬件上的流水操作, 利于提升路 由查找的吞吐率。 但是 Trie树结构的具有一定的局限性。 一般 Trie树结构的流水级数 较多, 会带来过大的查找延时。 采用多比特 Trie树结构的路由查找设计可以大大减少 流水级数, 但会带来大量额外内存的消耗, 并且这种额外的内存消耗量与路由表的前 缀分布相关,使得基于多比特 Trie树的路由查找硬件设计的路由表容量存在较大起伏。 特别是由于 IPv4和 IPv6的键值位宽相差 4倍, 同一个硬件架构很难同时支持 IPv4和 IPv6的路由查找, 增加了硬件设计的复杂度和成本。 The Trie tree structure is the most widely used tree structure, and it is easy to implement pipeline operations on hardware, which is beneficial to improve the throughput of route lookup. However, the Trie tree structure has certain limitations. Generally, the Trie tree structure has a large number of pipeline stages, which causes an excessive search delay. The route lookup design using a multi-bit Trie tree structure can greatly reduce the number of pipeline stages, but it will bring a lot of extra memory consumption, and this extra memory consumption is related to the prefix distribution of the routing table, so that the multi-bit Trie tree is based. There is a large ups and downs in the routing table capacity of the route lookup hardware design. In particular, because the key value width difference between IPv4 and IPv6 is 4 times, it is difficult for the same hardware architecture to support IPv4 and IPv6 route lookup at the same time, which increases the complexity and cost of hardware design.
TCAM能够在同一芯片中实现 IPv4和 IPv6的路由查找, 但要满足 lOOGbps的查 找速率和核心路由器的路由表容量需求, 需要多片 TCAM级联查找, 功耗与发热量将 成为严重问题。 TCAM can implement IPv4 and IPv6 route lookup in the same chip, but to meet the lOOGbps search rate and the core router's routing table capacity requirements, multiple TCAM cascaded lookups are required, and power consumption and heat generation will become serious problems.
B-tree 是一种被广泛应用于数据库文件管理的软件算法, 它的特点是一个树节点 拥有 M-1个关键字和 M个子节点, B-Tree的深度由阶数 M和关键字的数目决定, 与 关键字的分布无关。这些特点使得 B-Tree能够克服上述 Trie树结构的缺点, 实现流水 级数少且对路由前缀分布不敏感的路由查找设计。 需要注意的是在应用 B-Tree进行路由查找时, 需要确保返回的结果为最长前缀匹 配结果。 由于查找回溯是无法在硬件流水操作中实现的, 因此需要对 B-Tree的路由查 找算法进行特殊的处理。 这类处理有很多种公开的操作方法, 例如可以将父前缀复制 成多份合并到其所有子前缀上, 或者采用将父前缀与树结构最上层的子节点合并的方 法。 目前我们已经提出一种基于 B-Tree的高速路由查找方法和装置,它能够用硬件流 水线结构实现高性能实现 IPv4或者 IPv6的路由查找, 但它不能满足同时支持 IPv4和 IPv6路由查找的需求。 有鉴于此, 本发明提出一种能够同时实现 IPv4和 IPv6路由查找的方法及装置。 发明内容 本发明实施例的目的在于提供一种同时支持 IPv4和 IPv6的高速路由查找方法及 装置, 为了解决现有技术中能够实现 IPv4或者 IPv6的路由查找, 但它不能满足在相 同系统结构中同时支持 IPv4和 IPv6路由查找的需求的问题。 根据本发明实施例的一个方面, 提供了一种同时支持 IPv4和 IPv6的高速路由查 找方法, 包括以下步骤: 响应路由转发系统实时下发的路由条目更新指令, 对 IPv4和 IPv6共用树节点保 存的路由条目信息进行更新; 在路由查找期间, 根据路由查找请求确定需要进行 IPv4路由查找还是进行 IPv6 路由查找; 若确定需要进行 IPv4路由查找,则从 IPv4和 IPv6共用树结构寻找用于 IPv4路由 查找的 IPv4根节点, 并从 IPv4根节点开始按照流水查找方式从所述共用树结构的各 相应节点获得 IPv4路由信息; 若确定需要进行 IPv6路由查找,则从 IPv4和 IPv6共用树结构寻找用于 IPv6路由 查找的 IPv6根节点, 并从 IPv6根节点开始按照流水查找方式从所述共用树结构的各 相应节点获得 IPv6路由信息。 优选地, IPv4和 IPv6路由表存放在相同位宽的 B-Tree树节点中, IPv4路由表和 IPv6路由表动态共享多层节点, 其每层节点保存多条路由信息。 优选地, 所述内存区存有: IPv4根节点地址、 IPv6根节点地址、 所述多层节点以 及结果表。 优选地, 获得 IPv4路由信息包括: B-tree is a software algorithm widely used in database file management. It is characterized by a tree node with M-1 keywords and M child nodes. The depth of B-Tree is determined by the order M and the number of keywords. Decision, regardless of the distribution of keywords. These features enable B-Tree to overcome the shortcomings of the above Trie tree structure, and implement route lookup design with few pipeline stages and insensitive to route prefix distribution. It should be noted that when applying B-Tree for route lookup, you need to ensure that the result returned is the longest prefix match result. Since the lookup backtracking cannot be implemented in the hardware pipeline operation, the route check of the B-Tree is required. Find an algorithm for special handling. There are a number of publicly available methods of doing this, such as copying a parent prefix into multiple copies onto all of its sub-prefixes, or a method of merging the parent prefix with the child nodes at the top of the tree structure. At present, we have proposed a high-speed route search method and device based on B-Tree, which can realize high-performance IPv4 or IPv6 route lookup by hardware pipeline structure, but it can not meet the requirements of supporting both IPv4 and IPv6 route lookup. In view of this, the present invention proposes a method and apparatus capable of simultaneously performing IPv4 and IPv6 route lookup. SUMMARY OF THE INVENTION An object of the embodiments of the present invention is to provide a high-speed route search method and apparatus for supporting both IPv4 and IPv6. In order to solve the problem of IPv4 or IPv6 route lookup in the prior art, it cannot satisfy the same system structure. Support for the need for IPv4 and IPv6 route lookups. According to an aspect of the present invention, a high-speed route search method for supporting both IPv4 and IPv6 is provided, including the following steps: Responding to a route entry update command sent by a route forwarding system in real time, and saving the IPv4 and IPv6 shared tree nodes The routing entry information is updated. During the route lookup, it is determined whether an IPv4 route lookup or an IPv6 route lookup is required according to the route lookup request. If it is determined that an IPv4 route lookup is required, the IPv4 and IPv6 shared tree structure is used to find an IPv4 route lookup. An IPv4 root node, and obtains IPv4 routing information from respective nodes of the shared tree structure according to a pipeline search manner from an IPv4 root node; if it is determined that an IPv6 route lookup is required, the IPv4 and IPv6 shared tree structure is used to find an IPv6 route. The IPv6 root node is searched, and IPv6 routing information is obtained from each corresponding node of the shared tree structure according to a pipeline search manner from the IPv6 root node. Preferably, the IPv4 and IPv6 routing tables are stored in the B-Tree node of the same bit width, and the IPv4 routing table and the IPv6 routing table dynamically share the multi-layer nodes, and each layer node stores multiple routing information. Preferably, the memory area stores: an IPv4 root node address, an IPv6 root node address, the multi-layer node, and a result table. Preferably, obtaining the IPv4 routing information includes:
IPv4查找逻辑从所述路由查找请求中获取 IPv4键值, 并从所述内存区获取 IPv4 根节点地址; The IPv4 lookup logic obtains an IPv4 key value from the route lookup request, and obtains an IPv4 root node address from the memory area;
IPv4查找逻辑利用 IPv4根节点地址从 IPv4和 IPv6共用树结构找到 IPv4根节点, 通过读取并解析该节点的节点数据, 查找该节点路由信息, 并按照流水查找方式查找 下一级节点的路由信息, 直至查找最后一级节点的路由信息; 其中, IPv4查找逻辑通过将所述 IPv4键值与所解析的各节点的节点数据中的路由 前缀分别进行比较, 获得下一级节点指针, 并从各匹配的路由条目数据中得到相应的 IPv4路由信息。 优选地, 从各匹配的路由条目数据中得到相应的 IPv4路由信息包括: 将各匹配的路由条目中的结果表条目指针保存在查找模块的缓存中; 每级流水匹配的路由条目的结果表条目指针直接覆盖缓存中的内容; 在结束对所有节点路由查找之后,根据缓存中最终的结果表条目指针查找结果表, 获得相应的 IPv4路由信息。 优选地, 获得 IPv6路由信息包括: The IPv4 lookup logic uses the IPv4 root node address to find the IPv4 root node from the IPv4 and IPv6 shared tree structure, reads and parses the node data of the node, finds the routing information of the node, and searches the routing information of the next-level node according to the pipeline search mode. Until the routing information of the last-level node is found; wherein the IPv4 search logic obtains the next-level node pointer by comparing the IPv4 key value with the route prefix in the node data of each node being parsed, and Corresponding IPv4 routing information is obtained in the matched routing entry data. Preferably, obtaining the corresponding IPv4 routing information from each matched routing entry data comprises: saving a result table entry pointer in each matching routing entry in a cache of the searching module; a result table entry of the routing entry matching each level of the pipeline The pointer directly covers the contents of the cache; after ending the route lookup for all nodes, the result table is searched according to the final result table entry pointer in the cache to obtain the corresponding IPv4 routing information. Preferably, obtaining the IPv6 routing information includes:
IPv6查找逻辑从所述路由查找请求中获取 IPv6键值, 并从所述内存区获取 IPv6 根节点地址; The IPv6 lookup logic obtains an IPv6 key value from the route lookup request, and obtains an IPv6 root node address from the memory area;
IPv6查找逻辑利用 IPv6根节点地址从 IPv4和 IPv6共用树结构找到 IPv6根节点, 通过读取并解析该节点的节点数据, 查找该节点路由信息, 并按照流水查找方式查找 下一级节点的路由信息, 直至查找最后一级节点的路由信息; 其中, IPv6查找逻辑通过将所述 IPv6键值与所解析的各节点的节点数据中的路由 前缀分别进行比较, 获得下一级节点指针, 并从各匹配的路由条目数据中得到相应的 IPv6路由信息。 优选地, 从各匹配的路由条目数据中得到相应的 IPv6路由信息包括: 将各匹配的路由条目中的结果表条目指针保存在查找模块的缓存中; 每级流水匹配的路由条目的结果表条目指针直接覆盖缓存中的内容; 在结束对所有节点路由查找之后,根据缓存中最终的结果表条目指针查找结果表, 获得相应的 IPv6路由信息。 根据本发明实施例的另一方面, 提供了一种同时支持 IPv4和 IPv6的高速路由查 找装置, 包括: 路由条目信息更新模块,设置为响应路由转发系统实时下发的路由条目更新指令, 对 IPv4和 IPv6共用树节点保存的路由条目信息进行更新; 确定路由查找模块,设置为在路由查找期间,根据路由查找请求确定需要进行 IPv4 路由查找还是进行 IPv6路由查找; The IPv6 lookup logic uses the IPv6 root node address to find the IPv6 root node from the IPv4 and IPv6 shared tree structure. By reading and parsing the node data of the node, the routing information of the node is found, and the routing information of the next-level node is searched according to the pipeline searching manner. Until the routing information of the last-level node is found; wherein the IPv6 search logic compares the IPv6 key value with the route prefix in the node data of each node that is parsed, respectively, to obtain the next-level node pointer, and Corresponding IPv6 routing information is obtained in the matched routing entry data. Preferably, obtaining the corresponding IPv6 routing information from each matched routing entry data includes: saving a result table entry pointer in each matched routing entry in a cache of the searching module; a result table entry of the routing entry matching each level of the pipeline The pointer directly covers the contents of the cache; After the route lookup is completed for all nodes, the result table is searched according to the final result table entry pointer in the cache, and the corresponding IPv6 routing information is obtained. According to another aspect of the present invention, a high-speed route finder device for supporting both IPv4 and IPv6 is provided, including: a route entry information update module, configured to respond to a route entry update command sent by a route forwarding system in real time, to IPv4 The route entry information saved by the IPv6 shared tree node is updated; the route lookup module is determined to be configured to determine whether an IPv4 route lookup or an IPv6 route lookup is required according to the route lookup request during the route lookup request;
IPv4路由查找模块, 设置为当确定需要进行 IPv4路由查找, 则从 IPv4和 IPv6共 用树结构寻找用于 IPv4路由查找的 IPv4根节点, 并从 IPv4根节点开始按照流水查找 方式从所述共用树结构的各相应节点获得 IPv4路由信息; The IPv4 route lookup module is configured to: when it is determined that an IPv4 route lookup is required, find an IPv4 root node for IPv4 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv4 root node according to the pipeline search manner from the shared tree structure. Each corresponding node obtains IPv4 routing information;
IPv4结果获取模块,设置为 IPv4路由查找中,根据 IPv4路由查找模块获取的 IPv4 路由信息查找结果表, 获得实际的 IPv4路由查找结果。 The IPv4 result obtaining module is configured to look up the IPv4 routing information search result table obtained by the IPv4 route lookup module to obtain an actual IPv4 route search result.
IPv6路由查找模块, 设置为当确定需要进行 IPv6路由查找, 则从 IPv4和 IPv6共 用树结构寻找用于 IPv6路由查找的 IPv6根节点, 并从 IPv6根节点开始按照流水查找 方式从所述共用树结构的各相应节点获得 IPv6路由信息。 The IPv6 route lookup module is configured to: when it is determined that an IPv6 route lookup is required, find an IPv6 root node for IPv6 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv6 root node according to the pipeline search manner from the shared tree structure. Each corresponding node obtains IPv6 routing information.
IPv6结果获取模块,设置为 IPv6路由查找中,根据 IPv6路由查找模块获取的 IPv6 路由信息查找结果表, 获得实际的 IPv6路由查找结果。 优选地, 所述 IPv4路由查找模块包括: IPv4获取单元, 设置为 IPv4查找逻辑从所述路由查找请求中获取 IPv4键值, 并 从所述内存区获取 IPv4根节点地址; The IPv6 result obtaining module is configured to look up the IPv6 routing information search result obtained by the IPv6 route lookup module to obtain the actual IPv6 route search result. Preferably, the IPv4 route lookup module includes: an IPv4 acquisition unit, configured to obtain an IPv4 key value from the route lookup request by using an IPv4 lookup logic, and obtain an IPv4 root node address from the memory area;
IPv4查找单元, 设置为 IPv4查找逻辑利用 IPv4根节点地址从 IPv4和 IPv6共用 树结构找到 IPv4根节点, 通过读取并解析该节点的节点数据, 查找该节点路由信息, 并按照流水查找方式查找下一级节点的路由信息,直至查找最后一级节点的路由信息; 其中, IPv4查找逻辑通过将所述 IPv4键值与所解析的各节点的节点数据中的路由 前缀分别进行比较, 获得下一级节点指针, 并从各匹配的路由条目数据中得到相应的 IPv4路由信息。 优选地, 所述 IPv6路由查找模块包括: The IPv4 search unit is set to use the IPv4 root node address to find the IPv4 root node from the IPv4 and IPv6 shared tree structure by using the IPv4 root node address, and by reading and parsing the node data of the node, searching for the routing information of the node, and searching according to the pipeline search manner. Routing information of the first-level node until the routing information of the last-level node is searched; wherein the IPv4 search logic compares the IPv4 key value with the route prefix in the node data of each node that is parsed to obtain the next level. The node pointer, and obtain corresponding IPv4 routing information from each matched routing entry data. Preferably, the IPv6 route lookup module includes:
IPv6获取单元, 设置为 IPv6查找逻辑从所述路由查找请求中获取 IPv6键值, 并 从所述内存区获取 IPv6根节点地址; An IPv6 obtaining unit, configured to obtain an IPv6 key value from the route lookup request by using an IPv6 lookup logic, and obtain an IPv6 root node address from the memory area;
IPv6查找单元, 设置为 IPv6查找逻辑利用 IPv6根节点地址从 IPv4和 IPv6共用 树结构找到 IPv6根节点, 通过读取并解析该节点的节点数据, 查找该节点路由信息, 并按照流水查找方式查找下一级节点的路由信息,直至查找最后一级节点的路由信息; 其中, IPv6查找逻辑通过将所述 IPv6键值与所解析的各节点的节点数据中的路由 前缀分别进行比较, 获得下一级节点指针, 并从各匹配的路由条目数据中得到相应的 IPv6路由信息。 与现有技术相比较, 本发明实施例的有益效果在于: 本发明实施例能够支持大规模 IPv4和 IPv6路由表, 表项容量不随路由前缀的分 布波动, IPv4和 IPv6树结构的融合大大降低了内存需求, 提高了路由系统的灵活性, 能够同时满足核心路由器中 IPv4和 IPv6的高速路由查找需求, 给用户带来了方便, 并提高了用户体验。 附图说明 图 1是本发明实施例提供的一种同时支持 IPv4和 IPv6的高速路由查找方法流程 图; 图 2是本发明实施例提供的一种同时支持 IPv4和 IPv6的高速路由查找装置示意 图; 图 3是本发明实施例提供的同时实现 IPv4和 IPv6路由查找装置结构框图; 图 4是本发明实施例提供的 IPv4和 IPv6树结构融合示意图; 图 5是本发明实施例提供的路由查找算法软件模块的功能模块框图; 图 6是本发明实施例提供的路由查找硬件模块功能模块框图; 图 7是本发明实施例提供的路由查找硬件模块查找流程图; 图 8是本发明实施例提供的前缀结构示意图。 具体实施方式 以下结合附图对本发明的优选实施例进行详细说明, 应当理解, 以下所说明的优 选实施例仅用于说明和解释本发明, 并不用于限定本发明。 图 1显示了本发明实施例提供的一种同时支持 IPv4和 IPv6的高速路由查找方法 流程图, 如图 1所示, 包括以下步骤: 步骤 S101 : 响应路由转发系统实时下发的路由条目更新指令, 对 IPv4和 IPv6共 用树节点保存的路由条目信息进行更新; 步骤 S102: 在路由查找期间, 根据路由查找请求确定需要进行 IPv4路由查找还 是进行 IPv6路由查找; 步骤 S103: 若确定需要进行 IPv4路由查找, 则从 IPv4和 IPv6共用树结构寻找 用于 IPv4路由查找的 IPv4根节点,并从 IPv4根节点开始按照流水查找方式从所述共 用树结构的各相应节点获得 IPv4路由信息; 步骤 S104: 若确定需要进行 IPv6路由查找, 则从 IPv4和 IPv6共用树结构寻找 用于 IPv6路由查找的 IPv6根节点,并从 IPv6根节点开始按照流水查找方式从所述共 用树结构的各相应节点获得 IPv6路由信息。 本发明实施例 IPv4和 IPv6路由表存放在相同位宽的 B-Tree树节点中, IPv4路 由表和 IPv6路由表动态共享多层节点, 其每层节点保存多条路由信息。 其中, 所述内存区存有: IPv4根节点地址、 IPv6根节点地址、 所述多层节点以及 结果表。 本发明实施例获得 IPv4路由信息包括: IPv4查找逻辑从所述路由查找请求中获 取 IPv4键值, 并从所述内存区获取 IPv4根节点地址; IPv4查找逻辑利用 IPv4根节 点地址从 IPv4和 IPv6共用树结构找到 IPv4根节点,通过读取并解析该节点的节点数 据, 查找该节点路由信息, 并按照流水查找方式查找下一级节点的路由信息, 直至查 找最后一级节点的路由信息; 其中, IPv4查找逻辑通过将所述 IPv4键值与所解析的 各节点的节点数据中的路由前缀分别进行比较, 获得下一级节点指针, 并从各匹配的 路由条目数据中得到相应的 IPv4路由信息。 其中, 节点中的 IPv4路由前缀包括 VPN、 IPv4前缀、 IPv4前缀矢量 (Vector) 三个部分,其中 IPv4前缀矢量的每个比特都表示一个本前缀的前缀长度,若其中某个 比特为 ' , 则表示该前缀中存在该比特对应长度的前缀; 采用这种方法, 可以在同 一个 IPv4前缀中存放多条不同长度的、 具有父子关系的 IPv4路由前缀。 优选地, 从各匹配的路由条目数据中得到相应的 IPv4路由信息包括:将各匹配的 路由条目中的结果表条目指针保存在查找模块的缓存中; 每级流水匹配的路由条目的 结果表条目指针直接覆盖缓存中的内容; 在结束对所有节点路由查找之后, 根据缓存 中最终的结果表条目指针查找结果表, 获得相应的 IPv4路由信息。 本发明实施例获得 IPv6路由信息包括: IPv6查找逻辑从所述路由查找请求中获 取 IPv6键值, 并从所述内存区获取 IPv6根节点地址; IPv6查找逻辑利用 IPv6根节 点地址从 IPv4和 IPv6共用树结构找到 IPv6根节点,通过读取并解析该节点的节点数 据, 查找该节点路由信息, 并按照流水查找方式查找下一级节点的路由信息, 直至查 找最后一级节点的路由信息; 其中, IPv6查找逻辑通过将所述 IPv6键值与所解析的 各节点的节点数据中的路由前缀分别进行比较, 获得下一级节点指针, 并从各匹配的 路由条目数据中得到相应的 IPv6路由信息。 其中, 节点中的 IPv6路由前缀包括 VPN、 IPv6前缀、 IPv6前缀矢量 (Vector) 三个部分,其中 IPv6前缀矢量的每个比特都表示一个本前缀的前缀长度,若其中某个 比特为 ' 1 ', 则表示该前缀中存在该比特对应长度的前缀; 采用这种方法, 可以在同 一个 IPv6前缀中存放多条不同长度的、 具有父子关系的 IPv6路由前缀。 优选地, 从各匹配的路由条目数据中得到相应的 IPv6路由信息包括:将各匹配的 路由条目中的结果表条目指针保存在查找模块的缓存中; 每级流水匹配的路由条目的 结果表条目指针直接覆盖缓存中的内容; 在结束对所有节点路由查找之后, 根据缓存 中最终的结果表条目指针查找结果表, 获得相应的 IPv6路由信息。 本发明实施例所述的 IPv4和 IPv6共用树结构具有多层节点保存在内存区中, 并 且 IPv4和 IPv6节点具有相同的数据位宽,每层节点能够存放多条 IPv4路由信息和多 条 IPv6路由信息, 动态地分配给 IPv4或 IPv6使用。 图 2显示了本发明实施例提供的一种同时支持 IPv4和 IPv6的高速路由查找装置 示意图, 如图 2所示, 包括: 路由条目信息更新模块 201, 设置为响应路由转发系统 实时下发的路由条目更新指令, 对 IPv4和 IPv6共用树节点保存的路由条目信息进行 更新; 确定路由查找模块 202, 设置为在路由查找期间, 根据路由查找请求确定需要 进行 IPv4路由查找还是进行 IPv6路由查找; IPv4路由查找模块 203, 设置为当确定 需要进行 IPv4路由查找,则从 IPv4和 IPv6共用树结构寻找用于 IPv4路由查找的 IPv4 根节点,并从 IPv4根节点开始按照流水查找方式从所述共用树结构的各相应节点获得 IPv4路由信息; IPv6路由查找模块 204, 设置为当确定需要进行 IPv6路由查找, 则 从 IPv4和 IPv6共用树结构寻找用于 IPv6路由查找的 IPv6根节点,并从 IPv6根节点 开始按照流水查找方式从所述共用树结构的各相应节点获得 IPv6路由信息。 本发明实施例还包括: IPv4结果获取模块 205, 设置为 IPv4路由查找中, 根据 IPv4路由查找模块获取的 IPv4路由信息查找结果表,获得实际的 IPv4路由查找结果; IPv6结果获取模块 206,设置为 IPv6路由查找中,根据 IPv6路由查找模块获取的 IPv6 路由信息查找结果表, 获得实际的 IPv6路由查找结果。 所述 IPv4路由查找模块 203包括: IPv4获取单元, 设置为 IPv4查找逻辑从所述 路由查找请求中获取 IPv4键值, 并从所述内存区获取 IPv4根节点地址; IPv4查找单 元, 设置为 IPv4查找逻辑利用 IPv4根节点地址从 IPv4和 IPv6共用树结构找到 IPv4 根节点, 通过读取并解析该节点的节点数据, 查找该节点路由信息, 并按照流水查找 方式查找下一级节点的路由信息, 直至查找最后一级节点的路由信息; 其中, IPv4查 找逻辑通过将所述 IPv4 键值与所解析的各节点的节点数据中的路由前缀分别进行比 较, 获得下一级节点指针, 并从各匹配的路由条目数据中得到相应的 IPv4路由信息。 所述 IPv6路由查找模块 204包括: IPv6获取单元, 设置为 IPv6查找逻辑从所述 路由查找请求中获取 IPv6键值, 并从所述内存区获取 IPv6根节点地址; The IPv6 search unit is set to the IPv6 lookup logic to find the IPv6 root node from the IPv4 and IPv6 shared tree structure by using the IPv6 root node address, and by reading and parsing the node data of the node, searching for the routing information of the node, and searching according to the pipeline search manner. Routing information of the first-level node until the routing information of the last-level node is found; wherein the IPv6 search logic compares the IPv6 key value with the route prefix in the node data of each node that is parsed to obtain the next level. The node pointer, and obtain corresponding IPv6 routing information from each matched routing entry data. Compared with the prior art, the embodiments of the present invention have the following advantages: The embodiment of the present invention can support large-scale IPv4 and IPv6 routing tables, and the entry capacity does not fluctuate with the distribution of routing prefixes, and the convergence of the IPv4 and IPv6 tree structures is greatly reduced. The memory requirement improves the flexibility of the routing system and satisfies the high-speed route lookup requirements of IPv4 and IPv6 in the core router, which brings convenience to the user and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a flowchart of a high-speed route searching method for supporting both IPv4 and IPv6 according to an embodiment of the present invention; FIG. 2 is a schematic diagram of a high-speed route searching device for supporting both IPv4 and IPv6 according to an embodiment of the present invention; 3 is a block diagram of a device for performing IPv4 and IPv6 route lookup according to an embodiment of the present invention; FIG. 4 is a schematic diagram of a structure of IPv4 and IPv6 tree structure according to an embodiment of the present invention; FIG. FIG. 6 is a block diagram of a function module of a route lookup hardware module according to an embodiment of the present invention; FIG. 7 is a flowchart of a route lookup hardware module search according to an embodiment of the present invention; FIG. 8 is a prefix provided by an embodiment of the present invention; Schematic. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS The preferred embodiments of the present invention are described in detail below with reference to the accompanying drawings. FIG. 1 is a flowchart of a high-speed route search method for supporting both IPv4 and IPv6 according to an embodiment of the present invention. As shown in FIG. 1, the method includes the following steps: Step S101: Respond to a route entry update command sent by a route forwarding system in real time. And updating the routing entry information saved by the IPv4 and the IPv6 shared tree node; Step S102: determining, during the route searching, whether the IPv4 route search or the IPv6 route search is performed according to the route lookup request; Step S103: If it is determined that an IPv4 route lookup is required And searching for an IPv4 root node for IPv4 route lookup from the IPv4 and IPv6 shared tree structure, and obtaining IPv4 routing information from each corresponding node of the shared tree structure according to a pipeline search manner from the IPv4 root node; Step S104: An IPv6 route lookup is required, and an IPv6 root node for IPv6 route lookup is searched from the IPv4 and IPv6 shared tree structure, and IPv6 routing information is obtained from each corresponding node of the shared tree structure according to a pipeline search manner from the IPv6 root node. In the embodiment of the present invention, the IPv4 and IPv6 routing tables are stored in the B-Tree node of the same bit width. The IPv4 routing table and the IPv6 routing table dynamically share the multi-layer nodes, and each layer node stores multiple routing information. The memory area stores: an IPv4 root node address, an IPv6 root node address, the multi-layer node, and a result table. Obtaining the IPv4 routing information in the embodiment of the present invention includes: the IPv4 search logic acquires an IPv4 key value from the route lookup request, and obtains an IPv4 root node address from the memory area; the IPv4 lookup logic uses the IPv4 root node address to share from the IPv4 and the IPv6. The tree structure finds the IPv4 root node, finds and analyzes the node data of the node, finds the routing information of the node, and searches the routing information of the next-level node according to the pipeline searching manner, until the routing information of the last-level node is found; The IPv4 lookup logic obtains the next-level node pointer by comparing the IPv4 key value with the route prefix in the node data of each node that is parsed, and obtains corresponding IPv4 routing information from each matched route entry data. The IPv4 route prefix in the node includes a VPN, an IPv4 prefix, and an IPv4 prefix vector (Vector). Each bit of the IPv4 prefix vector indicates a prefix length of the prefix, if one of them If the bit is ', the prefix with the corresponding length of the bit exists in the prefix. In this method, multiple IPv4 route prefixes with different parent lengths can be stored in the same IPv4 prefix. Preferably, obtaining the corresponding IPv4 routing information from each matched routing entry data comprises: storing a result table entry pointer in each matching routing entry in a cache of the searching module; a result table entry of the routing entry matching each level of the pipeline The pointer directly covers the contents of the cache; after ending the route lookup for all nodes, the result table is searched according to the final result table entry pointer in the cache to obtain the corresponding IPv4 routing information. Obtaining the IPv6 routing information in the embodiment of the present invention includes: the IPv6 search logic acquires an IPv6 key value from the route lookup request, and obtains an IPv6 root node address from the memory area; the IPv6 lookup logic uses the IPv6 root node address to share from IPv4 and IPv6. The tree structure finds the IPv6 root node, finds and analyzes the node data of the node, finds the routing information of the node, and searches the routing information of the next-level node according to the pipeline searching manner, until the routing information of the last-level node is found; The IPv6 lookup logic obtains the next-level node pointer by comparing the IPv6 key value with the route prefix in the node data of each node that is parsed, and obtains corresponding IPv6 routing information from each matched route entry data. The IPv6 route prefix in the node includes a VPN, an IPv6 prefix, and an IPv6 prefix vector (Vector). Each bit of the IPv6 prefix vector indicates a prefix length of the prefix. If one of the bits is '1' The prefix of the corresponding length of the bit exists in the prefix. In this method, multiple IPv6 route prefixes with different parent lengths can be stored in the same IPv6 prefix. Preferably, obtaining the corresponding IPv6 routing information from each matched routing entry data includes: saving a result table entry pointer in each matched routing entry in a cache of the searching module; a result table entry of the routing entry matching each level of the pipeline The pointer directly covers the contents of the cache; after ending the route lookup for all nodes, the result table is searched according to the final result table entry pointer in the cache to obtain the corresponding IPv6 routing information. The IPv4 and IPv6 shared tree structure in the embodiment of the present invention has a multi-layer node stored in a memory area, and the IPv4 and IPv6 nodes have the same data bit width, and each layer node can store multiple pieces of IPv4 routing information and multiple IPv6 routes. Information, dynamically assigned to IPv4 or IPv6 usage. FIG. 2 is a schematic diagram of a high-speed route finder device for supporting both IPv4 and IPv6 according to an embodiment of the present invention. As shown in FIG. 2, the method includes: a route entry information update module 201, configured to respond to a route delivered by a route forwarding system in real time. An entry update command, updating routing entry information saved by the IPv4 and IPv6 shared tree nodes; determining a route lookup module 202, configured to determine whether an IPv4 route lookup or an IPv6 route lookup is required according to the route lookup request during the route lookup; IPv4 route The searching module 203 is configured to: when determining that an IPv4 route lookup is required, find an IPv4 root node for IPv4 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv4 root node according to the pipeline search manner from the shared tree structure. Each corresponding node obtains The IPv6 routing information module is configured to: when it is determined that an IPv6 route lookup is required, find an IPv6 root node for IPv6 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv6 root node according to the pipeline search manner. Each corresponding node of the shared tree structure obtains IPv6 routing information. The embodiment of the present invention further includes: an IPv4 result obtaining module 205, configured to perform an IPv4 routing information search result table obtained by the IPv4 route search module, and obtain an actual IPv4 route search result; the IPv6 result obtaining module 206 is set to In the IPv6 route lookup, the IPv6 route information lookup result table obtained by the IPv6 route lookup module is obtained, and the actual IPv6 route search result is obtained. The IPv4 route lookup module 203 includes: an IPv4 acquisition unit, configured to obtain an IPv4 key value from the route lookup request, and obtain an IPv4 root node address from the memory area; and an IPv4 search unit, set to an IPv4 lookup The logic uses the IPv4 root node address to find the IPv4 root node from the IPv4 and IPv6 shared tree structure, reads and parses the node data of the node, finds the routing information of the node, and searches the routing information of the next-level node according to the pipeline search manner until Finding routing information of the last-level node; wherein the IPv4 search logic obtains the next-level node pointer by comparing the IPv4 key value with the route prefix in the node data of each node that is parsed, and The corresponding IPv4 routing information is obtained in the routing entry data. The IPv6 route lookup module 204 includes: an IPv6 obtaining unit, configured to obtain an IPv6 key value from the route lookup request by using an IPv6 lookup logic, and obtain an IPv6 root node address from the memory area;
IPv6查找单元, 设置为 IPv6查找逻辑利用 IPv6根节点地址从 IPv4和 IPv6共用 树结构找到 IPv6根节点, 通过读取并解析该节点的节点数据, 查找该节点路由信息, 并按照流水查找方式查找下一级节点的路由信息,直至查找最后一级节点的路由信息; 其中, IPv6查找逻辑通过将所述 IPv6键值与所解析的各节点的节点数据中的路由前 缀分别进行比较, 获得下一级节点指针, 并从各匹配的路由条目数据中得到相应的 IPv6路由信息。 图 3显示了本发明实施例提供的同时实现 IPv4和 IPv6路由查找装置结构框图, 如图 3所示, 包括路由查找算法软件模块 301、 路由更新接口模块 302和路由查找硬 件模块 303。 其中, 路由查找算法软件模块 301完成对路由条目的软件计算和更新条 目指令下发; 路由更新接口模块 302在接收了软件更新条目指令后, 根据路由查找硬 件模块 303的实际工作状态, 控制路由查找硬件模块 303的数据流, 并将更新条目写 入路由查找硬件模块 303的存储器中; 路由查找硬件模块 303是双路并行的流水线型 架构, 分别响应硬件系统的 IPv4和 IPv6路由查找请求, 并返回最长前缀匹配的查找 结果。 优选地,路由查找算法软件模块 301运行在主控 CPU上,可以是高级算法语言(如 C、 C++语言)编写的 B-Tree算法软件程序, 计算和更新硬件路由表。 路由更新接口模 块 302是一个硬件模块, 包括缓存区和逻辑处理区两部分。 缓存区用于存放路由查找 算法软件模块 301写入的更新节点信息; 逻辑处理区用于根据路由查找硬件模块 303 的相关状态, 按照一定的顺序, 将更新节点数据写入路由查找硬件模块 303的节点内 存中。路由查找硬件模块 303是硬件路由查找的主要模块,是流水线设计,主要由 IPv4 查找逻辑区、 IPv6查找逻辑区和内存区构成。 IPv4和 IPv6查找逻辑分别处理相应的 查找请求, 并返回查找结果; 内存区也是分层结构, 用于存储 IPv4和 IPv6的节点数 据。 本发明的具体实施方法主要分为树结构设计、 软件模块设计和硬件模块设计三部 分来描述。 图 4显示了本发明实施例提供的 IPv4和 IPv6树结构融合示意图, 如图 4所示, 本发明的树结构设计是实际需求确定 IPv4和 IPv6的节点位宽, 树结构阶数 Ml和 M2、 树结构高度 N1和 N2、 每层节点的数目和结果表条目数, 从而确定硬件相应的流水级 数、 每层节点占用空间和结果表占用空间。 结构设计需要综合考虑 IPv4和 IPv6的基 本数据位宽, 路由表最大需求、 硬件内存读写代价、 硬件布局布线等因素。 The IPv6 search unit is set to the IPv6 lookup logic to find the IPv6 root node from the IPv4 and IPv6 shared tree structure by using the IPv6 root node address, and by reading and parsing the node data of the node, searching for the routing information of the node, and searching according to the pipeline search manner. Routing information of the first-level node until the routing information of the last-level node is found; wherein the IPv6 search logic compares the IPv6 key value with the route prefix in the node data of each node that is parsed to obtain the next level. The node pointer, and obtain corresponding IPv6 routing information from each matched routing entry data. FIG. 3 is a structural block diagram of a device for simultaneously performing IPv4 and IPv6 route searching according to an embodiment of the present invention. As shown in FIG. 3, the method includes a route lookup algorithm software module 301, a route update interface module 302, and a route lookup hardware module 303. The route search algorithm software module 301 completes the software calculation and update entry instruction delivery of the route entry. After receiving the software update entry instruction, the route update interface module 302 searches the actual working state of the hardware module 303 according to the route, and controls the route lookup. The data stream of the hardware module 303 is written into the memory of the route lookup hardware module 303; the route lookup hardware module 303 is a two-way parallel pipelined architecture that responds to the hardware system's IPv4 and IPv6 route lookup requests and returns The longest prefix matches the search result. Preferably, the route lookup algorithm software module 301 runs on the main control CPU, and may be a B-Tree algorithm software program written in a high-level algorithm language (such as C, C++ language) to calculate and update the hardware routing table. The route update interface module 302 is a hardware module, which includes a buffer area and a logical processing area. The buffer area is used to store the update node information written by the route lookup algorithm software module 301. The logic processing area is configured to search the related state of the hardware module 303 according to the route, and write the update node data into the route lookup hardware module 303 according to a certain order. In the node memory. The route lookup hardware module 303 is the main module of hardware route lookup, and is a pipeline design mainly composed of an IPv4 lookup logic area, an IPv6 lookup logic area, and a memory area. The IPv4 and IPv6 lookup logic respectively processes the corresponding lookup requests and returns the search results. The memory area is also a hierarchical structure for storing node data of IPv4 and IPv6. The specific implementation method of the present invention is mainly divided into three parts: tree structure design, software module design and hardware module design. FIG. 4 is a schematic diagram showing the fusion of the IPv4 and IPv6 tree structures provided by the embodiment of the present invention. As shown in FIG. 4, the tree structure design of the present invention is to determine the node width of the IPv4 and IPv6 nodes, and the tree structure orders M1 and M2. The tree structure heights N1 and N2, the number of nodes per layer, and the number of result table entries, thereby determining the corresponding number of pipeline stages of the hardware, the occupied space of each layer node, and the space occupied by the result table. The structure design needs to comprehensively consider the basic data bit width of IPv4 and IPv6, the maximum requirements of the routing table, the cost of reading and writing hardware memory, hardware layout and other factors.
IPv4和 IPv6两种路由查找分别通过两条流水线查找逻辑实现, 但它们的树节点 存储空间是共享的, 相同流水级数的 IPv4和 IPv6节点存储在相同的内存地址空间。 在 IPv4和 IPv6的树节点数据位宽保证相同的条件下, IPv4和 IPv6生成的树结构可 以如图 401和 402所示, 由于 IPv4的每个键值宽度是 32-bit, 而 IPv6的每个键值宽 度是 128-bit,因此在相同位宽的节点数据结构下, IPv4的 B-Tree的阶数 Ml大于 IPv6 的阶数 M2 ( IPv4的树节点能够索引更多的子节点)。 因此从树的形象上, IPv4的树形 状矮而胖, IPv6的树形状高而瘦。 如果将两个路由表简单相加, 则内存需求是两棵树 面积的简单相加, 并且在硬件设计上, 它们的内存将会相互独立。 本发明实施例的设计方案是如图 403所示, 将两棵树融合, 它们的树底部处于相 同层级, 每个层级的树节点由它们分别的最大需求确定,最大层级数由 IPv6的树高度 决定。 这样处理的优点是: 减少内存空间需求, 同时满足 IPv4和 IPv6的大容量路由 表需求; IPv4和 IPv6节点空间共享, 可以自动动态调整两种路由表的实际容量, 提 高查找设计对实际应用情况的适应性; 简化硬件设计复杂度, 降低硬件成本。 图 5显示了本发明实施例提供的路由查找算法软件模块的功能模块框图, 如图 5 所示, 整个路由算法软件模块基于 B-Tree 算法实现, 整体框架分是四大部分: IPv4 算法模块 501、 IPv6算法模块 502、 内存管理模块 503和更新硬件操作模块 504。 所述 IPv4算法模块架构 501包括插入操作模块、删除操作模块两部分。插入操作 模块主要工作是响应路由转发系统的路由插入指令, 并将下发的路由条目插入到 B-Tree树结构中。 删除操作模块主要工作是响应路由转发系统的路由删除指令, 并将 下发的路由条目从 B-Tree树结构中删除。 所述 IPv4算法模块 501和 IPv6算法模块 502采用相同的算法, 皆是基于 B-Tree 的路由查找算法, 区别仅是键值的位宽和 B-Tree的阶数不同。 所述内存管理模块 503的功能是对路由查找算法中的节点数据内存和结果表数据 内存进行管理,其中 IPv4和 IPv6的节点和结果表的空间由管理函数统一分配,即 IPv4 和 IPv6的节点和结果表在同一个资源池中进行分配, 使得它们能够相互共享资源,提 高查找装置的适应性。 所述更新硬件操作模块 504 的主要功能是更新硬件内存中的树节点和结果表条 目。 首先更新硬件操作模块 504将所有需要更新的信息记录在缓存中; 然后在插入操 作模块或删除操作模块结束后,将树节点从软件数据格式转换成约定的硬件数据格式; 最后将转换后的硬件数据和对应的硬件映射地址通过软硬件交互接口可以但不限于 LocalBus或 PCIe接口连续写入路由更新接口模块中。 该更新硬件操作模块 504的意 义在于减少软硬件的接口交互操作, 节省更新时间, 并减少条目更新对硬件实际查找 流水的影响。 图 6显示了本发明实施例提供的路由查找硬件模块功能模块框图, 如图 6所示, 包括路由更新接口模块 601和路由查找硬件模块 604。 所述路由更新接口模块 601包括缓存区 602和逻辑处理区 603两部分。缓存区 602 主要功能是接收存储软件通过软硬件交互接口写入的节点数据、 结果表条目数据和它 们对应的硬件地址, 这些数据已经由软件转换成硬件数据格式。 逻辑处理区 603主要 功能是在不影响正常查找的正确性条件下, 对硬件内存中的树节点和结果表条目数据 进行更新。 所述路由查找硬件模块 604主要功能是实现 IPv4和 IPv6的路由硬件查找功能, 包括 IPv4查找逻辑 605、 IPv6查找逻辑 606、 内存区 607、 指令分发 609和结果聚合 610五个部分。 所述的 IPv4查找逻辑 605主要功能是完成 IPv4的路由查找,返回 IPv4路由查找 结果。 IPv4查找流水共有 N1+1级,其中 LV_1至 LV_N1是树节点查找逻辑层, LV_N1+1 是结果表查找逻辑层。 每一个查找逻辑层都对应了内存区中的一块独立内存空间, 保 证各层对内存区的访问不会相互冲突。 所述的 IPv6查找逻辑 606主要功能是完成 IPv6的路由查找,返回 IPv6路由查找 结果。 IPv6查找流水共有 N2+1级,其中 LV_1至 LV_N2是树节点查找逻辑层, LV_N2+1 是结果表查找逻辑层。 每一个查找逻辑层都对应了内存区中的一块独立内存空间, 保 证各层对内存区的访问不会相互冲突。 所述内存区 607是路由查找硬件模块中的数据存储区域, 内存区中的各内存区域 相互独立, 分是根节点地址区域、 各层节点区域和结果表区域。 其中根结点地址 608 包括 IPv4根节点地址和 IPv6根节点地址,用于分别存储 IPv4和 IPv6的 B_Tree树结 构的根节点的地址。树节点区域的每层之间都相互独立,不与其它层树节点区域交叠, 避免查找流水同时访问的冲突。 结果表区域也是一块独立区域, 由查找流水的最后一 级访问。 所述的 IPv4查找逻辑 605和 IPv6查找逻辑 606中, 它们的查找流水底层处于相 同层级,但上层由于 IPv4树结构和 IPv6树结构的特点, 导致 IPv4的流水级数可能与 IPv6的流水级数不同分别是 N1+1级流水和 N2+1级流水, 因此本发明实施例的设计中 不保证 IPv4和 IPv6的路由查找请求之间的顺序性, 只保证 IPv4请求与 IPv4请求之 间的顺序性, 以及 IPv6请求与 IPv6请求之间的顺序性。 同时, 由于查找流水的级数不同, 存在 IPv4查找逻辑 605和 IPv6查找逻辑 606 同时访问内存区同一层节点的情况。这种情况可以通过多种方法解决,例如在内存 RAM 选择上采用有 2组读写端口的双端口 RAM; 也可以采用逻辑调度方式, 对查找逻辑的 读请求进行调度处理。 所述指令分发模块 609主要功能是根据外部输入指令的特征,区分是 IPv4指令还 是 IPv6指令, 然后将其分发给相应的查找逻辑进行处理。 所述结果聚合模块 610主要功能是将 IPv4和 IPv6的查找结果进行调度, 分别返 回。 图 7显示了本发明实施例提供的路由查找硬件模块查找流程图, 如图 7所示, 包 括以下步骤: 步骤 S701 : 路由查找硬件模块收到输入的查找请求; 步骤 S702: 对输入的查找请求查找键值进行分发, 将 IPv4请求发送给 IPv4查找 逻辑, 将 IPv6请求发送给 IPv6查在逻辑; 步骤 S703: 将查找键值信息和内存区中的根节点地址信息同时发送至第一级查找 流水中; 步骤 S704: 在流水的逻辑中首先对根节点地址是否是本级节点进行判断, 如果是 本级节点, 则向内存发起读节点请求, 等待内存返回节点数据; 如果不是本级节点, 则不向内存发起请求, 保留当前节点信息不改变; 步骤 S705: 将获得的节点信息进行解析, 并与键值进行比较; 如果未访问本级节 点, 则不需要进行解析比较, 打拍等待即可; 步骤 S706: 比较的结果如果存在命中, 则将命中的路由条目对应的结果记录, 覆 盖之前命中的结果; 如果未访问本级节点, 则不需要进行记录, 打拍等待; 步骤 S707: 如果进行了比较, 则从比较结果中获取下一级应访问的节点地址记录 在节点地址中; 如果未访问本级节点, 保留当前节点信息不改变; 步骤 S708: 查找流水携带键值信息、 节点地址和命中结果进入下一级流水处理逻 辑; 步骤 S709: 如果下一级流水不是最后一级, 则过程与上述 S704-S708流程相同, 如果下一级流水是最后一级, 则是访问结果表的处理逻辑 S710; 步骤 S710: 在结果表流水级中, 逻辑将根据命中结果表条目地址访问内存区的结 果表, 获得命中实际结果; 如果未命中, 则不访问结果表, 输出未命中信息; 步骤 S711 : 将查找结果送入结果聚合逻辑与另一条查找流水的结果进行调度; 步骤 S712:将命中的实际结果通过硬件接口返回,如果未命中,返回未命中信息。 图 8显示了本发明实施例提供的前缀结构示意图, 如图 8所示,包括 IPv4前缀结 构 801、 IPv6前缀结构 802、 IPv4节点指针 20— bit803以及 IPv6节点指针 20— bit804。 每个 IPv4的前缀结构 801包括: 32-bit前缀, 16-bit的 VPN, 24-bit的结果支 持超过 16M路由表, 26-bit Vector因是实际路由表中不会出现前缀长度 1_7的 IPv4 前缀。 所以 IPv4前缀结构所需的位宽是 98-bit。 每个 IPv6的前缀结构 802包括 128-bit前缀, 16-bit的 VPN, 24-bit的结果支 持超过 16M的路由表, 114-bit Vector因是实际路由表中不会出现前缀长度 1_15的 IPv6前缀。 所以所需 IPv6前缀结构的位宽是 282-bit。 Both IPv4 and IPv6 route lookups are implemented by two pipeline lookup logics, but their tree node storage space is shared, and IPv4 and IPv6 nodes of the same pipeline level are stored in the same memory address space. Under the condition that the tree node data bit width of IPv4 and IPv6 are guaranteed to be the same, the tree structure generated by IPv4 and IPv6 can be as shown in Figures 401 and 402, since each key-value width of IPv4 is 32-bit, and each of IPv6 The key-value width is 128-bit, so under the same bit-width node data structure, the order M1 of the B-Tree of IPv4 is greater than the order M2 of IPv6 (the tree node of IPv4 can index more child nodes). Therefore, from the image of the tree, the tree shape of IPv4 is short and fat, and the tree shape of IPv6 is high and thin. If you simply add two routing tables, the memory requirement is a simple sum of the two tree areas, and their hardware design will be independent of each other. The design of the embodiment of the present invention is as shown in FIG. 403. The two trees are merged, and the bottoms of the trees are at the same level. The tree nodes of each level are determined by their respective maximum demands, and the maximum number of levels is determined by the tree height of IPv6. Decide. The advantages of this processing are: Reduce the memory space requirement, and meet the requirements of large-capacity routing tables of IPv4 and IPv6; IPv4 and IPv6 node space sharing, can automatically adjust the actual capacity of the two routing tables automatically, and improve the actual application of the search design. Adaptability; Simplify hardware design complexity and reduce hardware costs. FIG. 5 is a block diagram showing the function modules of the route lookup algorithm software module provided by the embodiment of the present invention. As shown in FIG. 5, the entire routing algorithm software module is implemented based on the B-Tree algorithm, and the overall framework is divided into four parts: the IPv4 algorithm module 501 The IPv6 algorithm module 502, the memory management module 503, and the update hardware operation module 504. The IPv4 algorithm module architecture 501 includes two parts: an insert operation module and a delete operation module. The main operation of the insert operation module is to respond to the route insert instruction of the route forwarding system, and insert the delivered route entry into the B-Tree tree structure. The main operation of the delete operation module is to respond to the route deletion instruction of the route forwarding system, and delete the delivered route entry from the B-Tree tree structure. The IPv4 algorithm module 501 and the IPv6 algorithm module 502 use the same algorithm, which are both B-Tree-based route lookup algorithms, except that the bit width of the key value and the order of the B-Tree are different. The function of the memory management module 503 is to manage the node data memory and the result table data memory in the route lookup algorithm, wherein the space of the IPv4 and IPv6 nodes and the result table are uniformly allocated by the management function, that is, the nodes of the IPv4 and the IPv6. The result tables are allocated in the same resource pool, enabling them to share resources with each other and improve the adaptability of the search device. The primary function of the update hardware operation module 504 is to update tree nodes and result table entries in hardware memory. First, the update hardware operation module 504 records all the information that needs to be updated in the cache; then, after inserting the operation module or deleting the operation module, converting the tree node from the software data format to the agreed hardware data format; finally, the converted hardware The data and the corresponding hardware mapped address can be continuously written into the route update interface module through the software and hardware interaction interface, but not limited to the LocalBus or PCIe interface. The significance of the update hardware operation module 504 is to reduce the interface interaction of the hardware and software, save the update time, and reduce the impact of the item update on the actual hardware lookup flow. FIG. 6 is a block diagram showing the function module of the route lookup hardware module provided by the embodiment of the present invention. As shown in FIG. 6, the route update interface module 601 and the route lookup hardware module 604 are included. The route update interface module 601 includes a buffer area 602 and a logical processing area 603. The main function of the buffer area 602 is to receive the node data written by the storage software through the software and hardware interaction interface, the result table entry data and their corresponding hardware addresses, which have been converted into hardware data formats by software. The main function of the logical processing area 603 is to update the tree node and the result table entry data in the hardware memory under the condition that the correctness of the normal search is not affected. The main function of the route lookup hardware module 604 is to implement IPv4 and IPv6 routing hardware lookup functions, including IPv4 lookup logic 605, IPv6 lookup logic 606, memory area 607, instruction dispatch 609, and result aggregation 610. The main function of the IPv4 lookup logic 605 is to complete the IPv4 route lookup and return the IPv4 route lookup result. The IPv4 lookup pipeline has a total of N1+1 levels, where LV_1 to LV_N1 are tree node lookup logic layers, and LV_N1+1 is a result table lookup logic layer. Each search logic layer corresponds to a separate memory space in the memory area, ensuring that the accesses of the layers to the memory area do not conflict with each other. The main function of the IPv6 lookup logic 606 is to complete the IPv6 route lookup and return the IPv6 route lookup result. The IPv6 lookup pipeline has a total of N2+1 levels, where LV_1 to LV_N2 are tree node lookup logic layers, and LV_N2+1 is a result table lookup logic layer. Each search logic layer corresponds to a separate memory space in the memory area, ensuring that the accesses of the layers to the memory area do not conflict with each other. The memory area 607 is a data storage area in the route lookup hardware module, and each memory area in the memory area is independent of each other, and is divided into a root node address area, each layer node area, and a result table area. The root node address 608 includes an IPv4 root node address and an IPv6 root node address for respectively storing the addresses of the root nodes of the B_Tree tree structure of IPv4 and IPv6. Each layer of the tree node area is independent of each other and does not overlap with other layer tree node areas, so as to avoid conflicts in the simultaneous access of the pipeline. The resulting table area is also a separate area accessed by the last level of the search flow. In the IPv4 lookup logic 605 and the IPv6 lookup logic 606, the lookup pipeline bottom layer is at the same level, but the upper layer may have different IPv6 pipeline stages than the IPv6 pipeline level due to the characteristics of the IPv4 tree structure and the IPv6 tree structure. The N1+1-level pipeline and the N2+1-level pipeline are respectively configured. Therefore, the sequence between the IPv4 and IPv6 route lookup requests is not guaranteed in the design of the embodiment of the present invention, and only the order between the IPv4 request and the IPv4 request is guaranteed. And the ordering between IPv6 requests and IPv6 requests. At the same time, since the number of levels of the lookup pipeline is different, there are cases where the IPv4 lookup logic 605 and the IPv6 lookup logic 606 simultaneously access the same layer node in the memory area. This situation can be solved by a variety of methods, such as dual-port RAM with two sets of read-write ports in the memory RAM selection; logical scheduling can also be used to schedule read requests for lookup logic. The main function of the instruction distribution module 609 is to distinguish whether it is an IPv4 instruction or an IPv6 instruction according to the characteristics of the external input instruction, and then distribute it to the corresponding search logic for processing. The main function of the result aggregation module 610 is to schedule the IPv4 and IPv6 search results and return them separately. FIG. 7 is a flowchart of searching for a route lookup hardware module according to an embodiment of the present invention. As shown in FIG. 7, the method includes the following steps: Step S701: The route lookup hardware module receives the input search request. Step S702: The input search request search key value is distributed, the IPv4 request is sent to the IPv4 search logic, and the IPv6 request is sent to the IPv6 check logic. Step S703: The search key value information and the root node address information in the memory area are simultaneously sent to the first level search stream; Step S704: In the logic of the pipeline, first determine whether the root node address is the current level node, if it is the current level node , initiating a read node request to the memory, waiting for the memory to return the node data; if not the current level node, not requesting to the memory, leaving the current node information unchanged; step S705: parsing the obtained node information, and the key value If the node is not accessed, the analysis comparison is not required, and the waiting is performed; Step S706: If there is a hit, the result of the comparison is recorded, and the result corresponding to the hit route entry is recorded, and the result of the previous hit is overwritten; If the node of the level is not accessed, no recording is required, and the beating waits; Step S70 7: If a comparison is made, the node address that should be accessed by the next level is recorded in the node address from the comparison result; if the node of the current level is not accessed, the current node information is retained unchanged; Step S708: Searching for the water carrying key value information The node address and the hit result enter the next stage flow processing logic; Step S709: If the next stage flow is not the last stage, the process is the same as the above S704-S708 process, and if the next stage flow is the last stage, the access is The processing logic S710 of the result table; Step S710: In the result table water level, the logic will access the result table of the memory area according to the hit result table entry address, and obtain the hit actual result; if it is missed, the result table is not accessed, and the output misses Information: Step S711: The search result is sent to the result aggregation logic and the result of another search flow is scheduled; Step S712: return the actual result of the hit through the hardware interface, and if not, return the miss information. FIG. 8 is a schematic diagram of a prefix structure provided by an embodiment of the present invention. As shown in FIG. 8, an IPv4 prefix structure 801, an IPv6 prefix structure 802, an IPv4 node pointer 20-bit 803, and an IPv6 node pointer 20-bit 804 are included. Each IPv4 prefix structure 801 includes: a 32-bit prefix, a 16-bit VPN, and a 24-bit result supports more than 16M routing tables. The 26-bit Vector does not have an IPv4 prefix with a prefix length of 1_7 in the actual routing table. . So the bit width required for the IPv4 prefix structure is 98-bit. Each IPv6 prefix structure 802 includes a 128-bit prefix, a 16-bit VPN, and a 24-bit result supports a routing table of more than 16M. The 114-bit Vector does not have an IPv6 prefix with a prefix length of 1_15 in the actual routing table. . So the bit width of the required IPv6 prefix structure is 282-bit.
IPv4 和 IPv6的节点指针都是 20-bit, 满足大规模的树结构。 那么每层节点数据位宽是 A*M+B*M+1。其中 A是前缀结构的位宽, M是前缀结构的 数目, B是节点指针的位宽。 由于大部分树节点可能存储在 DDR上, DDR的访问数据位宽是 128-bit的整数倍, 因此每层节点的数据位宽也最好是 128的整数倍。 则要求 A1*M1+20*M2+1 128N , A2*M2+20*M2+1 128N。 其中 A1是 IPv4的前缀 结构位宽, A2是 IPv6前缀结构位宽, Ml和 M2分别是每层节点中的 IPv4和 IPv6的前 缀数目。 可以选择的数值是: Both IPv4 and IPv6 node pointers are 20-bit, which satisfies a large-scale tree structure. Then the data bit width of each layer node is A*M+B*M+1. Where A is the bit width of the prefix structure, M is the number of prefix structures, and B is the bit width of the node pointer. Since most of the tree nodes may be stored on the DDR, the access data bit width of the DDR is an integer multiple of 128-bit, so the data bit width of each layer node is preferably an integer multiple of 128. Then A1*M1+20*M2+1 128N, A2*M2+20*M2+1 128N are required. A1 is the prefix structure width of IPv4, A2 is the IPv6 prefix structure bit width, and Ml and M2 are the number of IPv4 and IPv6 prefixes in each layer node respectively. The values that can be selected are:
Ml = 8, M2 = 3, N = 8; 此时 IPv4节点需求位宽是 964_bit, IPv6需求位宽是 926-bit, 实际分配的节点位宽是 1024-bit。 这种配置下在大容量需求下流水级数较 少, 对 DDR性能要求一般, 同时浪费的内存较少。可以预计这种配置下要满足 4M容量 IPv4路由表和 1M容量 IPv6路由表需求, 需要 11级流水, 600 Mb的节点内存空间。 也可以选择数值是: Ml = 8, M2 = 3, N = 8; At this time, the IPv4 node requirement bit width is 964_bit, the IPv6 requirement bit width is 926-bit, and the actually allocated node bit width is 1024-bit. In this configuration, the number of pipelines under the large capacity requirement is small, the DDR performance is generally required, and the wasted memory is small. It can be expected that in this configuration, the 4M capacity IPv4 routing table and the 1M capacity IPv6 routing table requirement are required, and 11 levels of pipeline water and 600 Mb of node memory space are required. You can also choose a value that is:
Ml = 5, M2 = 2, N=5;此时 IPv4节点需求位宽是 610-bit, IPv6需求位宽是 624-bit, 实际分配的节点位宽是 660-bit。 这种配置下, 对 DDR性能要求较低, 同时浪费的内 存最少,但流水级数需求较多,特别是对于 IPv6路由需要更多的流水级数才能满足较 大规模路由表。 可以预计这种配置下, 要满足 512k容量的 IPv4路由和 32k容量 IPv6 路由, 需要 11级流水, 70 Mb节点内存空间。 本发明实施例的数据格式主要分是节点数据格式、 结果表数据格式。 节点数据中 包括: 键值、 标记矢量、 结果表地址、 下一级指针四个部分。 键值是路由表中的路由 前缀; 标记矢量是 B-Tree算法中的标记同一前缀中不同前缀长度条目的标记矢量; 结 果表地址是本路由条目对应的查找结果在结果表的地址信息; 下一级指针是经过本级 查找后, 下一级应访问的节点地址。其中 IPv4的 B-Tree节点和 IPv6的节点具有相同 的节点位宽, 同一流水级的树节点存储在相同的内存地址空间中, 通过 IPv4和 IPv6 不同的节点解析逻辑来区分。 本发明实施例设计的硬件查找结构是自底向上生长的 B-Tree 树结构。 首先根据 IPv4和 IPv6路由表容量需求定义 B-Tree的阶数 M1&M2和树高度 N1&N2, 并根据它们 分别的树高度设计设定相应的流水级数; 然后根据算法填充情况定义出每层树结构最 大的节点数目需求, 按照最大节点数目设定相应的内存空间; 最后根据路由表实际容 量需求设定结果表的内存空间。 本发明实施例从整体上设计了路由查找系统的软件算法模块、 硬件数据结构、 更 新流程、 查找流水结构和内存结构, 能够同时满足 IPv4和 IPv6的路由查找, 满足大 容量路由表的高性能查找需求。 综上所述, 本发明实施例具有以下技术效果: 本发明实施例能够支持大规模 IPv4和 IPv6路由表, 能够同时满足核心路由器中 IPv4和 IPv6的高速路由查找需求, 给用户带来了方便, 并提高了用户体验。 尽管上文对本发明进行了详细说明, 但是本发明不限于此, 本技术领域技术人员 可以根据本发明的原理进行各种修改。 因此, 凡按照本发明原理所作的修改, 都应当 理解是落入本发明的保护范围。 工业实用性 本发明实施例提供的技术方案可以应用于网络交换技术领域, 能够支持大规模 IPv4和 IPv6路由表, 表项容量不随路由前缀的分布波动, IPv4和 IPv6树结构的融合 大大降低了内存需求, 提高了路由系统的灵活性, 能够同时满足核心路由器中 IPv4和 IPv6的高速路由查找需求, 给用户带来了方便, 并提高了用户体验。 Ml = 5, M2 = 2, N=5; at this time, the IPv4 node requirement bit width is 610-bit, the IPv6 requirement bit width is 624-bit, and the actually allocated node bit width is 660-bit. In this configuration, the DDR performance requirements are low, and the wasted memory is the least, but the number of pipeline stages is high. Especially for IPv6 routing, more pipeline stages are needed to satisfy the larger-scale routing table. It can be expected that in this configuration, to meet the 512k capacity of IPv4 routing and 32k capacity IPv6 routing, 11 levels of pipeline and 70 Mb of node memory space are required. The data format of the embodiment of the present invention is mainly divided into a node data format and a result table data format. The node data includes: key value, tag vector, result table address, and next level pointer. The key value is the route prefix in the routing table; the tag vector is a tag vector in the B-Tree algorithm that marks different prefix length entries in the same prefix; The table address is the address information of the result list corresponding to the routing entry in the result table; the next level pointer is the node address that should be accessed by the next level after the level search. The IPv4 B-Tree node and the IPv6 node have the same node bit width, and the tree nodes of the same pipeline level are stored in the same memory address space, and are distinguished by different node resolution logics of IPv4 and IPv6. The hardware lookup structure designed in the embodiment of the present invention is a bottom-up B-Tree tree structure. First, define the order M1&M2 and tree height N1&N2 of B-Tree according to the IPv4 and IPv6 routing table capacity requirements, and set the corresponding pipeline level according to their respective tree heights. Then define the maximum tree structure of each layer according to the algorithm filling situation. The number of nodes needs to be set according to the maximum number of nodes; finally, the memory space of the result table is set according to the actual capacity requirement of the routing table. The embodiment of the invention designs the software algorithm module, the hardware data structure, the update process, the search pipeline structure and the memory structure of the route lookup system as a whole, and can simultaneously satisfy the route lookup of IPv4 and IPv6, and satisfy the high performance search of the large-capacity routing table. demand. In summary, the embodiments of the present invention have the following technical effects: The embodiments of the present invention can support large-scale IPv4 and IPv6 routing tables, and can simultaneously satisfy the high-speed route searching requirements of IPv4 and IPv6 in the core router, and bring convenience to the user. And improve the user experience. Although the invention has been described in detail above, the invention is not limited thereto, and various modifications may be made by those skilled in the art in accordance with the principles of the invention. Therefore, modifications made in accordance with the principles of the invention are understood to fall within the scope of the invention. Industrial Applicability The technical solution provided by the embodiments of the present invention can be applied to the field of network switching technologies, and can support large-scale IPv4 and IPv6 routing tables. The capacity of the entry does not fluctuate with the distribution of the routing prefix. The fusion of the IPv4 and IPv6 tree structures greatly reduces the memory. The demand increases the flexibility of the routing system and satisfies the high-speed route lookup requirements of IPv4 and IPv6 in the core router, which brings convenience to the user and improves the user experience.

Claims

权 利 要 求 书 、 一种同时支持 IPv4和 IPv6的高速路由查找方法, 包括: 响应路由转发系统实时下发的路由条目更新指令, 对 IPv4和 IPv6共用树 节点保存的路由条目信息进行更新;  The method for claiming a high-speed route search method for supporting both IPv4 and IPv6, comprising: responding to a route entry update command sent by a route forwarding system in real time, and updating routing entry information saved by the IPv4 and IPv6 shared tree nodes;
在路由查找期间,根据路由查找请求确定需要进行 IPv4路由查找还是进行 IPv6路由查找; 若确定需要进行 IPv4路由查找,则从 IPv4和 IPv6共用树结构寻找用于 IPv4 路由查找的 IPv4根节点, 并从 IPv4根节点开始按照流水查找方式从所述共用 树结构的各相应节点获得 IPv4路由信息;  During route lookup, it is determined whether an IPv4 route lookup or an IPv6 route lookup is required according to the route lookup request; if it is determined that an IPv4 route lookup is required, the IPv4 root node for IPv4 route lookup is searched from the IPv4 and IPv6 shared tree structure, and The IPv4 root node starts to obtain IPv4 routing information from each corresponding node of the shared tree structure according to a pipeline search manner;
若确定需要进行 IPv6路由查找,则从 IPv4和 IPv6共用树结构寻找用于 IPv6 路由查找的 IPv6根节点, 并从 IPv6根节点开始按照流水查找方式从所述共用 树结构的各相应节点获得 IPv6路由信息。 、 根据权利要求 1所述的方法,其中, IPv4和 IPv6路由表存放在相同位宽的 B-Tree 树节点中, IPv4路由表和 IPv6路由表动态共享多层节点,其每层节点保存多条 路由信息。 、 根据权利要求 2所述的方法, 其中, 内存区存有: IPv4根节点地址、 IPv6根节 点地址、 所述多层节点以及结果表。 、 根据权利要求 2所述的方法, 其中, 获得 IPv4路由信息包括:  If it is determined that an IPv6 route lookup is required, the IPv6 root node for IPv6 route lookup is searched from the IPv4 and IPv6 shared tree structure, and the IPv6 route is obtained from each corresponding node of the shared tree structure according to the pipeline search manner from the IPv6 root node. information. The method according to claim 1, wherein the IPv4 and IPv6 routing tables are stored in a B-Tree node of the same bit width, and the IPv4 routing table and the IPv6 routing table dynamically share the multi-layer node, and each node of the layer is saved in multiple pieces. Routing information. The method according to claim 2, wherein the memory area stores: an IPv4 root node address, an IPv6 root node address, the multi-layer node, and a result table. The method of claim 2, wherein obtaining the IPv4 routing information comprises:
IPv4查找逻辑从所述路由查找请求中获取 IPv4键值, 并从所述内存区获 取 IPv4根节点地址; The IPv4 lookup logic obtains an IPv4 key value from the route lookup request, and obtains an IPv4 root node address from the memory area;
IPv4查找逻辑利用 IPv4根节点地址从 IPv4和 IPv6共用树结构找到 IPv4 根节点, 通过读取并解析该节点的节点数据, 查找该节点路由信息, 并按照流 水查找方式查找下一级节点的路由信息, 直至查找最后一级节点的路由信息; 其中, IPv4查找逻辑通过将所述 IPv4键值与所解析的各节点的节点数据 中的路由前缀分别进行比较, 获得下一级节点指针, 并从各匹配的路由条目数 据中得到相应的 IPv4路由信息。 根据权利要求 4所述的方法,其中,从各匹配的路由条目数据中得到相应的 IPv4 路由信息包括: 将各匹配的路由条目中的结果表条目指针保存在查找模块的缓存中; 每级流水匹配的路由条目的结果表条目指针直接覆盖缓存中的内容; 在结束对所有节点路由查找之后, 根据缓存中最终的结果表条目指针查找 结果表, 获得相应的 IPv4路由信息。 、 根据权利要求 2所述的方法, 其中, 获得 IPv6路由信息包括: The IPv4 lookup logic uses the IPv4 root node address to find the IPv4 root node from the IPv4 and IPv6 shared tree structure, reads and parses the node's node data, finds the node's routing information, and finds the routing information of the next-level node according to the pipeline search mode. Until the routing information of the last-level node is found; wherein the IPv4 search logic obtains the next-level node pointer by comparing the IPv4 key value with the route prefix in the node data of each node being parsed, and Corresponding IPv4 routing information is obtained in the matched routing entry data. The method of claim 4, wherein the obtaining the corresponding IPv4 routing information from each of the matched routing entry data comprises: The result table entry pointer in each matching routing entry is saved in the cache of the lookup module; the result table entry pointer of each level of the matching route entry directly covers the content in the cache; after ending the route lookup for all nodes, according to the cache The final result table entry pointer looks up the result table and obtains the corresponding IPv4 routing information. The method of claim 2, wherein obtaining IPv6 routing information comprises:
IPv6查找逻辑从所述路由查找请求中获取 IPv6键值, 并从所述内存区获 取 IPv6根节点地址; The IPv6 lookup logic obtains an IPv6 key value from the route lookup request, and obtains an IPv6 root node address from the memory area;
IPv6查找逻辑利用 IPv6根节点地址从 IPv4和 IPv6共用树结构找到 IPv6 根节点, 通过读取并解析该节点的路由数据, 查找该节点路由信息, 并按照流 水查找方式查找下一级节点的路由信息, 直至查找最后一级节点的路由信息; 其中, IPv6查找逻辑通过将所述 IPv6键值与所解析的各节点的节点数据 中的路由前缀分别进行比较, 获得下一级节点指针, 并从各匹配的路由条目数 据中得到相应的 IPv6路由信息。 、 根据权利要求 6所述的方法,其中,从各匹配的路由条目数据中得到相应的 IPv6 路由信息包括:  The IPv6 lookup logic uses the IPv6 root node address to find the IPv6 root node from the IPv4 and IPv6 shared tree structure, reads and parses the routing data of the node, finds the routing information of the node, and searches the routing information of the next-level node according to the pipeline search mode. Until the routing information of the last-level node is found; wherein the IPv6 search logic compares the IPv6 key value with the route prefix in the node data of each node that is parsed, respectively, to obtain the next-level node pointer, and Corresponding IPv6 routing information is obtained in the matched routing entry data. The method according to claim 6, wherein the obtaining the corresponding IPv6 routing information from each matched routing entry data comprises:
将各匹配的路由条目中的结果表条目指针保存在查找模块的缓存中; 每级流水匹配的路由条目的结果表条目指针直接覆盖缓存中的内容; 在结束对所有节点路由查找之后, 根据缓存中最终的结果表条目指针查找 结果表, 获得相应的 IPv6路由信息。 、 一种同时支持 IPv4和 IPv6的高速路由查找装置, 包括: 路由条目信息更新模块, 设置为响应路由转发系统实时下发的路由条目更 新指令, 对 IPv4和 IPv6共用树节点保存的路由条目信息进行更新; 确定路由查找模块, 设置为在路由查找期间, 根据路由查找请求确定需要 进行 IPv4路由查找还是进行 IPv6路由查找;  The result table entry pointer in each matching routing entry is saved in the cache of the lookup module; the result table entry pointer of each level of the matching route entry directly covers the content in the cache; after ending the route lookup for all nodes, according to the cache The final result table entry pointer looks up the result table and obtains the corresponding IPv6 routing information. A high-speed route finder device that supports both IPv4 and IPv6, and includes: a route entry information update module, configured to respond to a route entry update command sent by the route forwarding system in real time, and perform routing entry information saved by the IPv4 and IPv6 shared tree nodes. Updating; determining a route lookup module, configured to determine whether an IPv4 route lookup or an IPv6 route lookup is required according to the route lookup request during route lookup;
IPv4路由查找模块, 设置为当确定需要进行 IPv4路由查找, 则从 IPv4和 IPv6共用树结构寻找用于 IPv4路由查找的 IPv4根节点,并从 IPv4根节点开始 按照流水查找方式从所述共用树结构的各相应节点获得 IPv4路由信息;  The IPv4 route lookup module is configured to: when it is determined that an IPv4 route lookup is required, find an IPv4 root node for IPv4 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv4 root node according to the flow water lookup manner from the shared tree structure. Each corresponding node obtains IPv4 routing information;
IPv4结果获取模块, 设置为 IPv4路由查找中, 根据 IPv4路由查找模块获 取的 IPv4路由信息查找结果表, 获得实际的 IPv4路由查找结果; IPv6路由查找模块, 设置为当确定需要进行 IPv6路由查找, 则从 IPv4和 IPv6共用树结构寻找用于 IPv6路由查找的 IPv6根节点,并从 IPv6根节点开始 按照流水查找方式从所述共用树结构的各相应节点获得 IPv6路由信息; The IPv4 result obtaining module is configured to perform an IPv4 routing search result table according to the IPv4 routing information search result table obtained by the IPv4 route lookup module, and obtain an actual IPv4 route search result. The IPv6 route lookup module is configured to: when it is determined that an IPv6 route lookup is required, find an IPv6 root node for IPv6 route lookup from the IPv4 and IPv6 shared tree structure, and start from the IPv6 root node according to the pipeline search manner from the shared tree structure. Each corresponding node obtains IPv6 routing information;
IPv6结果获取模块, 设置为 IPv6路由查找中, 根据 IPv6路由查找模块获 取的 IPv6路由信息查找结果表, 获得实际的 IPv6路由查找结果。 、 根据权利要求 8所述的装置, 其中, 所述 IPv4路由查找模块包括:  The IPv6 result obtaining module is configured to look up the IPv6 routing information search result obtained by the IPv6 route lookup module to obtain the actual IPv6 route search result. The device according to claim 8, wherein the IPv4 route lookup module comprises:
IPv4获取单元, 设置为 IPv4查找逻辑从所述路由查找请求中获取 IPv4键 值, 并从所述内存区获取 IPv4根节点地址; An IPv4 obtaining unit, configured to obtain an IPv4 key value from the route lookup request by using an IPv4 lookup logic, and obtain an IPv4 root node address from the memory area;
IPv4查找单元,设置为 IPv4查找逻辑利用 IPv4根节点地址从 IPv4和 IPv6 共用树结构找到 IPv4根节点, 通过读取并解析该节点的节点数据, 查找该节点 路由信息, 并按照流水查找方式查找下一级节点的路由信息, 直至查找最后一 级节点的路由信息;  The IPv4 search unit is set to use the IPv4 root node address to find the IPv4 root node from the IPv4 and IPv6 shared tree structure by using the IPv4 root node address, and by reading and parsing the node data of the node, searching for the routing information of the node, and searching according to the pipeline search manner. Routing information of the first-level node until the routing information of the last-level node is found;
其中, IPv4查找逻辑通过将所述 IPv4键值与所解析的各节点的节点数据 中的路由前缀分别进行比较, 获得下一级节点指针, 并从各匹配的路由条目数 据中得到相应的 IPv4路由信息。 0、 根据权利要求 8所述的装置, 其中, 所述 IPv6路由查找模块包括:  The IPv4 search logic obtains the next-level node pointer by comparing the IPv4 key value with the route prefix in the node data of each node that is parsed, and obtains the corresponding IPv4 route from each matched route entry data. information. 0. The device according to claim 8, wherein the IPv6 route lookup module comprises:
IPv6获取单元, 设置为 IPv6查找逻辑从所述路由查找请求中获取 IPv6键 值, 并从所述内存区获取 IPv6根节点地址; An IPv6 obtaining unit, configured to obtain an IPv6 key value from the route lookup request by using an IPv6 lookup logic, and obtain an IPv6 root node address from the memory area;
IPv6查找单元,设置为 IPv6查找逻辑利用 IPv6根节点地址从 IPv4和 IPv6 共用树结构找到 IPv6根节点, 通过读取并解析该节点的节点数据, 查找该节点 路由信息, 并按照流水查找方式查找下一级节点的路由信息, 直至查找最后一 级节点的路由信息;  The IPv6 search unit is set to IPv6 lookup logic to find the IPv6 root node from the IPv4 and IPv6 shared tree structure by using the IPv6 root node address, and by reading and parsing the node data of the node, searching for the routing information of the node, and searching according to the pipeline search manner. Routing information of the first-level node until the routing information of the last-level node is found;
其中, IPv6查找逻辑通过将所述 IPv6键值与所解析的各节点的节点数据 中的路由前缀分别进行比较, 获得下一级节点指针, 并从各匹配的路由条目数 据中得到相应的 IPv6路由信息。  The IPv6 search logic obtains the next-level node pointer by comparing the IPv6 key value with the route prefix in the node data of each node that is parsed, and obtains the corresponding IPv6 route from each matched route entry data. information.
PCT/CN2014/077912 2013-09-03 2014-05-20 High-speed routing lookup method and device simultaneously supporting ipv4 and ipv6 WO2015032214A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310396381.5 2013-09-03
CN201310396381.5A CN104426774A (en) 2013-09-03 2013-09-03 High-speed routing lookup method and device simultaneously supporting IPv4 and IPv6

Publications (1)

Publication Number Publication Date
WO2015032214A1 true WO2015032214A1 (en) 2015-03-12

Family

ID=52627769

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/077912 WO2015032214A1 (en) 2013-09-03 2014-05-20 High-speed routing lookup method and device simultaneously supporting ipv4 and ipv6

Country Status (2)

Country Link
CN (1) CN104426774A (en)
WO (1) WO2015032214A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111131049A (en) * 2019-12-31 2020-05-08 盛科网络(苏州)有限公司 Method and device for processing routing table entry
CN115664807A (en) * 2022-10-25 2023-01-31 渔翁信息技术股份有限公司 SSL VPN forwarding method, device, system and storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106302172A (en) * 2015-05-18 2017-01-04 深圳市中兴微电子技术有限公司 Support Hash lookup and the storage of route querying, lookup method and device simultaneously
CN112187743B (en) * 2020-09-14 2022-10-28 北京云杉世纪网络科技有限公司 Network policy matching method and system based on IP address longest prefix
CN114911728A (en) * 2021-02-07 2022-08-16 华为技术有限公司 Data searching method and device and integrated circuit

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004030305A2 (en) * 2002-09-30 2004-04-08 Mosaid Technologies Incorporated Improved dense mode coding scheme
CN101437016A (en) * 2007-11-16 2009-05-20 北京乾坤化物数字技术有限公司 Method for building IP address structure tree
CN101582851A (en) * 2009-06-12 2009-11-18 中兴通讯股份有限公司 Method and system for realizing sharing route capacity on dual-stacker router
CN102461092A (en) * 2009-04-24 2012-05-16 代尔夫特科技大学 Data structure, method and system for address lookup

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004030305A2 (en) * 2002-09-30 2004-04-08 Mosaid Technologies Incorporated Improved dense mode coding scheme
CN101437016A (en) * 2007-11-16 2009-05-20 北京乾坤化物数字技术有限公司 Method for building IP address structure tree
CN102461092A (en) * 2009-04-24 2012-05-16 代尔夫特科技大学 Data structure, method and system for address lookup
CN101582851A (en) * 2009-06-12 2009-11-18 中兴通讯股份有限公司 Method and system for realizing sharing route capacity on dual-stacker router

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111131049A (en) * 2019-12-31 2020-05-08 盛科网络(苏州)有限公司 Method and device for processing routing table entry
CN111131049B (en) * 2019-12-31 2021-08-27 苏州盛科通信股份有限公司 Method and device for processing routing table entry
CN115664807A (en) * 2022-10-25 2023-01-31 渔翁信息技术股份有限公司 SSL VPN forwarding method, device, system and storage medium

Also Published As

Publication number Publication date
CN104426774A (en) 2015-03-18

Similar Documents

Publication Publication Date Title
US9871727B2 (en) Routing lookup method and device and method for constructing B-tree structure
Li et al. Packet forwarding in named data networking requirements and survey of solutions
CN100421088C (en) Digital data processing device and method for managing cache data
JP5529976B2 (en) Systolic array architecture for high-speed IP lookup
JP6356675B2 (en) Aggregation / grouping operation: Hardware implementation of hash table method
US7805427B1 (en) Integrated search engine devices that support multi-way search trees having multi-column nodes
US9495398B2 (en) Index for hybrid database
WO2015032214A1 (en) High-speed routing lookup method and device simultaneously supporting ipv4 and ipv6
US20130268770A1 (en) Cryptographic hash database
US20070168377A1 (en) Method and apparatus for classifying Internet Protocol data packets
KR102437775B1 (en) Page cache device and method for efficient mapping
TW200402639A (en) Method and data structure for a low memory overhead database
TWI655575B (en) System and method for enabling a high read rate of a data element list
WO2020125630A1 (en) File reading
WO2023000536A1 (en) Data processing method and system, device, and medium
WO2014029084A1 (en) Data storage method and search method and device
WO2015176315A1 (en) Hash join method, device and database management system
CN113377689B (en) Routing table item searching and storing method and network chip
WO2015067004A1 (en) Concurrent access request processing method and device
US8935508B1 (en) Implementing pseudo content access memory
US8645620B2 (en) Apparatus and method for accessing a memory device
US7953721B1 (en) Integrated search engine devices that support database key dumping and methods of operating same
CN104301227B (en) High-speed low-power-consumption IP route table lookup method based on TCAM
CN110138661A (en) Name data network content storage pool neural network based
CN102739550B (en) Based on the multi-memory flowing water routing architecture that random copy distributes

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14841846

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14841846

Country of ref document: EP

Kind code of ref document: A1