CN102271087B - A kind of method for searching route and device - Google Patents
A kind of method for searching route and device Download PDFInfo
- Publication number
- CN102271087B CN102271087B CN201110211927.6A CN201110211927A CN102271087B CN 102271087 B CN102271087 B CN 102271087B CN 201110211927 A CN201110211927 A CN 201110211927A CN 102271087 B CN102271087 B CN 102271087B
- Authority
- CN
- China
- Prior art keywords
- address
- destination
- routing
- routing table
- entry information
- Prior art date
- Legal status (The legal status 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 status listed.)
- Expired - Fee Related
Links
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明公开了一种路由查找方法和装置,基于counting bloom filter数据结构在外部存储器或者路由寻址芯片中存储路由表项信息,从存储的路由表项信息中查找目的IP地址对应的路由表项信息。本发明与现有技术中以树形结构为基础的流水处理相比,对存储量要求明显降低,也易于对存储的路由表项进行维护。采用本发明的路由查找方案减少了路由寻址芯片的使用,不会产生较大功耗与发热量。
The present invention discloses a routing search method and device. Based on the counting bloom filter data structure, routing table item information is stored in an external memory or a routing addressing chip, and the routing table item corresponding to the destination IP address is searched from the stored routing table item information. information. Compared with the stream processing based on the tree structure in the prior art, the present invention obviously reduces the storage requirement and is easy to maintain the stored routing table items. Adopting the routing search solution of the present invention reduces the use of routing addressing chips, and does not generate large power consumption and heat generation.
Description
技术领域technical field
本发明涉及数据通信技术领域,尤其涉及一种路由查找方法和装置。The invention relates to the technical field of data communication, in particular to a route search method and device.
背景技术Background technique
随着Internet的迅猛发展,用于主干网络互联的核心路由器的接口速率达到100Gbps,该速率要求核心路由器在支持大容量路由表的情况下路由查找速率达到每秒几百万次。With the rapid development of the Internet, the interface rate of the core router used for the interconnection of the backbone network reaches 100Gbps, which requires the core router to support a large-capacity routing table with a routing lookup rate of several million times per second.
路由表中的每条路由表项信息包含前缀和下一跳信息,在查找目的IP(InternetProtocol,互联网协议)地址时需要得到最长匹配前缀,由于高速查找的需要,软件查找方法已经不适用,近年来研究人员提出了多种硬件查找方法以提高查找速率,其中以流水处理和TCAM(ternary content addressable memory,三态内容寻址存储器)最为流行。Each routing entry information in the routing table contains prefix and next hop information. When searching for the destination IP (Internet Protocol, Internet Protocol) address, it is necessary to obtain the longest matching prefix. Due to the need for high-speed searching, the software searching method is no longer applicable. In recent years, researchers have proposed a variety of hardware search methods to increase the search rate, among which pipeline processing and TCAM (ternary content addressable memory, ternary content addressable memory) are the most popular.
流水处理通常以树形结构为基础,能够得到较高的吞吐率。但由于树结构的特殊性,使得每级流水难以达到存储平衡,且每个树结点都要维护孩子结点信息,造成存储需求很大。即使利用一些优化方法可以达到存储平衡,也容易造成流水级数过多,难以维护。Pipeline processing is usually based on a tree structure, which can get a higher throughput rate. However, due to the particularity of the tree structure, it is difficult to achieve storage balance at each level of pipeline, and each tree node must maintain child node information, resulting in a large storage requirement. Even if some optimization methods can be used to achieve storage balance, it is easy to cause too many pipeline stages and it is difficult to maintain.
TCAM是目前路由查找中使用较为广泛的技术,查找过程简单,但要满足100Gbps的查找速率要求,则需要多片TCAM调度查找,功耗与发热量将成为严重问题。TCAM is currently a widely used technology in routing lookup. The lookup process is simple, but to meet the search rate requirement of 100Gbps, multiple TCAMs are required to schedule lookups, and power consumption and heat generation will become serious problems.
发明内容Contents of the invention
本发明要解决的技术问题是,提供一种路由查找方法和装置,基于bloom filter算法实现路由查找,克服通过现有技术中硬件方式实现路由查找导致的功耗与发热量大的缺陷。The technical problem to be solved by the present invention is to provide a routing search method and device, which realize routing search based on bloom filter algorithm, and overcome the defects of high power consumption and heat generation caused by implementing routing search by hardware in the prior art.
本发明采用的技术方案是,所述路由查找方法,包括:The technical solution adopted in the present invention is that the route search method includes:
基于counting bloom filter数据结构在外部存储器或者路由寻址芯片中存储路由表项信息,从存储的路由表项信息中查找目的IP地址对应的路由表项信息。Based on the counting bloom filter data structure, the routing table entry information is stored in the external memory or the routing addressing chip, and the routing table entry information corresponding to the destination IP address is searched from the stored routing table entry information.
进一步的,所述基于counting bloom filter数据结构存储路由表项信息,具体包括:Further, the storing routing table item information based on the counting bloom filter data structure specifically includes:
基于counting bloom filter数据结构将路由表中的所有路由表项信息存入外部存储器,将存入外部存储器过程中发生溢出的路由表项信息存入路由寻址芯片中。Based on the counting bloom filter data structure, all the routing table item information in the routing table is stored in the external memory, and the routing table item information that overflows during the process of storing in the external memory is stored in the routing addressing chip.
进一步的,所述基于counting bloom filter数据结构从存储的路由表项信息中查找目的IP地址对应的路由表项信息,具体包括:Further, the searching for the routing table item information corresponding to the destination IP address from the stored routing table item information based on the counting bloom filter data structure specifically includes:
基于counting bloom filter数据结构在外部存储器中查找目的IP地址对应的路由表项信息,同时在路由寻址芯片中查找目的IP地址对应的路由表项信息;Based on the counting bloom filter data structure, look up the routing table entry information corresponding to the destination IP address in the external memory, and at the same time look up the routing table entry information corresponding to the destination IP address in the routing addressing chip;
若只在外部存储器或者路由寻址芯片中查找到路由表项信息,则将其作为目的IP地址对应的路由表项信息;If the routing table entry information is only found in the external memory or the routing addressing chip, use it as the routing table entry information corresponding to the destination IP address;
若在外部存储器和路由寻址芯片中均查找到路由表项信息,将其中具有较长前缀者作为目的IP地址对应的路由表项信息。If the routing table entry information is found in both the external memory and the routing addressing chip, the one with the longer prefix is used as the routing table entry information corresponding to the destination IP address.
进一步的,所述基于counting bloom filter数据结构在外部存储器中查找目的IP地址对应的路由表项信息,具体包括:Further, the searching the routing entry information corresponding to the destination IP address in the external memory based on the counting bloom filter data structure specifically includes:
基于counting bloom filter数据结构为目的IP地址匹配目标前缀,根据目标前缀中置1的比特位确定外部存储器地址;Match the target prefix for the destination IP address based on the counting bloom filter data structure, and determine the external memory address according to the bit set to 1 in the target prefix;
通过外部存储器地址访问外部存储器,获取目的IP地址对应的最长前缀,所述最长前缀所在的路由表项信息即为最终查找到的目的IP地址对应的路由表项信息。The external memory is accessed through the external memory address to obtain the longest prefix corresponding to the destination IP address, and the routing table entry information where the longest prefix is located is the routing table entry information corresponding to the finally found destination IP address.
进一步的,所述基于counting bloom filter数据结构为目的IP地址匹配目标前缀,根据目标前缀中置1的比特位确定外部存储器地址,具体包括:Further, the matching target prefix for the destination IP address based on the counting bloom filter data structure, and determining the external memory address according to the bit set to 1 in the target prefix, specifically includes:
设counting bloom filter数据结构分别对应两个以上的存储空间,在各存储空间中对目的IP地址并行匹配得到对应的结果集和地址集;Let the counting bloom filter data structure correspond to more than two storage spaces respectively, and match the destination IP address in parallel in each storage space to obtain the corresponding result set and address set;
将各存储空间分别对应的结果集相与之后得到与目的IP地址匹配的目标前缀;After ANDing the result sets corresponding to each storage space, the target prefix matching the target IP address is obtained;
根据目标前缀中置1的比特位对应的地址集中相应位置的内容确定外部存储器地址。The external memory address is determined according to the content of the corresponding position in the address set corresponding to the bit set to 1 in the target prefix.
基于上述方法,本发明还提供一种路由查找装置,包括:Based on the above method, the present invention also provides a routing search device, including:
存储操作单元,用于基于counting bloom filter数据结构在外部存储器或者路由寻址芯片中存储路由表项信息;The storage operation unit is used to store routing table item information in the external memory or routing addressing chip based on the counting bloom filter data structure;
查找操作单元,用于基于counting bloom filter数据结构从存储的路由表项信息中查找目的IP地址对应的路由表项信息。A search operation unit, configured to search for routing table entry information corresponding to the destination IP address from stored routing table entry information based on the counting bloom filter data structure.
进一步的,所述存储操作单元,具体包括:Further, the storage operation unit specifically includes:
第一存储操作模块,用于基于counting bloom filter数据结构将路由表中的所有路由表项信息存入外部存储器,发生溢出时调用第二存储操作子模块;The first storage operation module is used to store all the routing entry information in the routing table into the external memory based on the counting bloom filter data structure, and call the second storage operation submodule when overflow occurs;
第二存储操作模块,用于将存入外部存储器过程中发生溢出的路由表项信息存入路由寻址芯片中。The second storage operation module is used for storing the routing table item information overflowed during the storage into the external memory into the routing addressing chip.
进一步的,所述查找操作单元,具体包括:Further, the search operation unit specifically includes:
第一查找操作模块,用于基于counting bloom filter数据结构在外部存储器中查找目的IP地址对应的路由表项信息;The first search operation module is used to search the routing table entry information corresponding to the destination IP address in the external memory based on the counting bloom filter data structure;
第二查找操作模块,用于与第一查找操作模块同时启动,在路由寻址芯片中查找到目的IP地址对应的路由表项信息;The second search operation module is used to start simultaneously with the first search operation module, and find the routing entry information corresponding to the destination IP address in the routing addressing chip;
比较模块,用于当第一查找操作模块和第二查找操作模块均查找到路由表项信息时,将其中具有较长前缀者作为目的IP地址对应的路由表项信息。The comparison module is configured to use the one with the longer prefix as the routing table entry information corresponding to the destination IP address when both the first search operation module and the second search operation module find the routing table entry information.
进一步的,所述第一查找操作模块,具体包括:Further, the first search operation module specifically includes:
地址确定子模块,用于基于counting bloom filter数据结构为目的IP地址匹配目标前缀,根据目标前缀中置1的比特位确定外部存储器地址;The address determination submodule is used to match the target prefix for the destination IP address based on the counting bloom filter data structure, and determine the external memory address according to the bit set to 1 in the target prefix;
前缀确定子模块,用于通过外部存储器地址访问外部存储器,获取目的IP地址对应的最长前缀,所述最长前缀所在的路由表项信息即为最终查找到的目的IP地址对应的路由表项信息。The prefix determination submodule is used to access the external memory through the external memory address, and obtain the longest prefix corresponding to the destination IP address, and the routing table entry information where the longest prefix is located is the routing table entry corresponding to the destination IP address that is finally found information.
进一步的,所述地址确定子模块,具体用于:Further, the address determination submodule is specifically used for:
在counting bloom filter数据结构对应的两个以上存储空间中对目的IP地址并行匹配得到对应的结果集和地址集,将各存储空间分别对应的结果集相与之后得到与目的IP地址匹配的目标前缀,根据目标前缀中置1的比特位对应的地址集中相应位置的内容确定外部存储器地址。Match the destination IP address in parallel in two or more storage spaces corresponding to the counting bloom filter data structure to obtain the corresponding result set and address set, and compare the result sets corresponding to each storage space to obtain the target prefix matching the destination IP address , determine the external memory address according to the content of the corresponding position in the address set corresponding to the bit set to 1 in the target prefix.
采用上述技术方案,本发明至少具有下列优点:Adopt above-mentioned technical scheme, the present invention has following advantage at least:
本发明所述路由查找方法和装置,基于counting bloom filter数据结构实现路由查找,与现有技术中以树形结构为基础的流水处理相比,对存储量要求明显降低,也易于对存储的路由表项进行维护。采用本发明的路由查找方案减少了路由寻址芯片的使用,不会产生较大功耗与发热量。The routing search method and device of the present invention realize routing search based on the counting bloom filter data structure. Compared with the tree structure-based pipeline processing in the prior art, the storage capacity requirements are significantly reduced, and the stored routing is also easy. Table entries are maintained. Adopting the routing search solution of the present invention reduces the use of routing addressing chips, and does not generate large power consumption and heat generation.
附图说明Description of drawings
图1为本发明第一实施例的路由查找方法流程图;Fig. 1 is the flow chart of the route lookup method of the first embodiment of the present invention;
图2为本发明第一实施例的路由查找方案示意图;FIG. 2 is a schematic diagram of a route lookup scheme according to the first embodiment of the present invention;
图3为本发明第一实施例步骤S103中基于counting bloom filter数据结构在外部存储器中查找目的IP地址对应的路由表项信息的过程示意图;3 is a schematic diagram of the process of searching the routing entry information corresponding to the destination IP address in the external memory based on the counting bloom filter data structure in step S103 of the first embodiment of the present invention;
图4为本发明第一实施例步骤A1的具体流程图;FIG. 4 is a specific flowchart of step A1 of the first embodiment of the present invention;
图5为本发明第二实施例的路由查找装置结构示意图;5 is a schematic structural diagram of a route lookup device according to a second embodiment of the present invention;
图6为本发明第三实施例的路由查找装置结构示意图;6 is a schematic structural diagram of a route lookup device according to a third embodiment of the present invention;
图7(a)为本发明第四实施例中第一、二存储空间结构示意图;Fig. 7(a) is a schematic structural diagram of the first and second storage spaces in the fourth embodiment of the present invention;
图7(b)为本发明第四实施例中第三存储空间结构示意图;Fig. 7(b) is a schematic diagram of the structure of the third storage space in the fourth embodiment of the present invention;
图8为本发明第四实施例中第三存储空间的过滤器索引index与片外dram(dynamic random access memory,动态随机存储器)的偏移地址的对应关系示意图。FIG. 8 is a schematic diagram of the corresponding relationship between the filter index index of the third storage space and the offset address of the off-chip dram (dynamic random access memory, dynamic random access memory) in the fourth embodiment of the present invention.
具体实施方式detailed description
为更进一步阐述本发明为达成预定目的所采取的技术手段及功效,以下结合附图及较佳实施例,对本发明进行详细说明如后。In order to further explain the technical means and functions adopted by the present invention to achieve the intended purpose, the present invention will be described in detail below in conjunction with the accompanying drawings and preferred embodiments.
本发明第一实施例,一种路由查找方法,如图1所示,包括以下具体步骤:In the first embodiment of the present invention, a route search method, as shown in Figure 1, includes the following specific steps:
步骤S101,基于counting bloom filter数据结构将路由表中的所有路由表项信息存入外部存储器,将存入外部存储器过程中发生溢出的路由表项信息存入路由寻址芯片中,路由寻址芯片可以为TCAM。外部存储器可以为片外dram。步骤S101具体包括:Step S101, based on the counting bloom filter data structure, store all the routing table item information in the routing table into the external memory, store the overflowing routing table item information in the process of storing the external memory into the routing addressing chip, and the routing addressing chip Can be TCAM. External memory can be off-chip dram. Step S101 specifically includes:
设counting bloom filter数据结构对应一个位宽为M比特、地址长度为N比特的第一存储空间,M可取大于等于1的整数,且M越大,在后续的查找中发生假阳性falsepositive的概率越低,但是受硬件提供的存储空间的限制,M最大通常可以取到4。Assume that the counting bloom filter data structure corresponds to a first storage space with a bit width of M bits and an address length of N bits. M can be an integer greater than or equal to 1, and the larger M is, the higher the probability of false positives occurring in subsequent searches. Low, but limited by the storage space provided by the hardware, the maximum value of M can usually be 4.
第一存储空间每一单元块可填入的数值为0、1、......、2M-1,第一存储空间的每一单元块地址用过滤器索引index表示;本领域中公知的,用与counting bloom filter数据结构对应的存储空间绑定的P1个哈希函数,对路由表项信息中的前缀进行运算得到的结果数值不会超过该存储空间的地址范围。The value that can be filled in each unit block of the first storage space is 0, 1, ..., 2 M -1, and the address of each unit block in the first storage space is represented by a filter index index; in the art It is known that, using the P1 hash functions bound to the storage space corresponding to the counting bloom filter data structure, the value of the result obtained from the operation on the prefix in the routing entry information will not exceed the address range of the storage space.
对路由表中的每一条路由表项信息中的前缀进行P1次哈希函数运算,每次哈希计算均能得到一个单元块的过滤器索引index,对各过滤器索引index出现的次数进行计数累加并将计数值填入该过滤器索引index对应的单元块中,计数值的初始值为0。Perform P1 hash function operations on the prefix in each routing entry information in the routing table, each hash calculation can get a filter index index of a unit block, and count the number of occurrences of each filter index index Accumulate and fill the count value into the unit block corresponding to the filter index index, and the initial value of the count value is 0.
若当前路由表项信息经某次哈希函数运算得到的过滤器索引index的计数值在累加前已为2M-1,则表示发生溢出,不再累加计数值,将该路由表项信息填入路由寻址芯片中;If the count value of the filter index index obtained by the current routing table item information through a hash function operation is 2 M -1 before the accumulation, it means overflow occurs, the count value will not be accumulated, and the routing table item information will be filled Into the routing addressing chip;
若对当前路由表项信息中的前缀经P1次哈希函数运算得到的过滤器索引index的计数值均未超过2M-1,选择计数值最小的过滤器索引index,在外部存储器中偏移地址为(2M-1)×index处填入该条路由表项信息。If the count value of the filter index index obtained by P1 hash function operations on the prefix in the current routing entry information does not exceed 2 M -1, select the filter index index with the smallest count value and offset it in the external memory The address is (2 M -1)×index and fill in the information of this routing entry.
本领域公知的,存储空间的地址长度N、哈希函数的个数P1、在外部存储器中进行路由查找时发生假阳性概率F的之间换算关系如下:As known in the art, the conversion relationship between the address length N of the storage space, the number P1 of hash functions, and the false positive probability F during routing lookup in the external memory is as follows:
N=ceil((n log(F))/log(1.0/(pow(2.0,log(2.0)))));P1=round(Nlog(2.0)/n);n代表待插入的路由表项个数。N=ceil((n log(F))/log(1.0/(pow(2.0, log(2.0))))); P1=round(Nlog(2.0)/n); n represents the routing entry to be inserted number.
步骤S102,在内部存储器中查找目的IP地址对应的路由表项信息,若找到,则流程结束,若未找到,则执行步骤S103。本实施例的路由查找方案示意图如图2所示。内部存储器可以为片内sram(static random access memory,静态随机存储器),或者片内edram(enhanced dynamic random access memory,增强动态随机存取存储器)。Step S102, searching the internal memory for routing entry information corresponding to the destination IP address, if found, the process ends, if not found, then step S103 is executed. A schematic diagram of a routing lookup solution in this embodiment is shown in FIG. 2 . The internal memory may be on-chip sram (static random access memory, static random access memory), or on-chip edram (enhanced dynamic random access memory, enhanced dynamic random access memory).
步骤S103,基于counting bloom filter数据结构在外部存储器中查找目的IP地址对应的路由表项信息,同时在路由寻址芯片中查找目的IP地址对应的路由表项信息,根据查找的情况分为以下两种方式处理:Step S103, based on the counting bloom filter data structure, look up the routing table entry information corresponding to the destination IP address in the external memory, and at the same time look up the routing table entry information corresponding to the destination IP address in the routing addressing chip. According to the situation of the search, it is divided into the following two Ways to deal with:
1)若只在外部存储器或者路由寻址芯片中查找到路由表项信息,则将其作为目的IP地址对应的路由表项信息;1) If the routing table entry information is only found in the external memory or routing addressing chip, then use it as the routing table entry information corresponding to the destination IP address;
2)若在外部存储器和路由寻址芯片中均查找到路由表项信息,将其中具有较长前缀者作为目的IP地址对应的路由表项信息。2) If the routing table entry information is found in both the external memory and the routing addressing chip, the one with the longer prefix is used as the routing table entry information corresponding to the destination IP address.
步骤S103中基于counting bloom filter数据结构在外部存储器中查找目的IP地址对应的路由表项信息的过程,如图3所示,具体包括:In step S103, the process of searching the routing entry information corresponding to the destination IP address in the external memory based on the counting bloom filter data structure, as shown in Figure 3, specifically includes:
A1,基于counting bloom filter数据结构为目的IP地址匹配目标前缀。如图4所示,步骤A1具体包括:A1, based on the counting bloom filter data structure, match the target prefix for the destination IP address. As shown in Figure 4, step A1 specifically includes:
设目的IP地址的长度为L,目的IP地址的所有前缀的范围是从长度1到长度为L;设counting bloom filter数据结构分别对应两个以上的存储空间,所述存储空间的每一单元块地址用过滤器索引index表示,不同的存储空间分别绑定不同的哈希函数,为了便于实现,本实施例中不同的存储空间绑定的哈希函数的个数相同,均为P2;各存储空间的位宽可以相同也可以不同,地址长度可以相同也可以不同。本步中,M可取大于等于1的整数,且M越大,在后续的查找中发生假阳性false positive的概率越低,但是受硬件提供的存储空间的限制,M最大通常可以取到4。Let the length of the destination IP address be L, and the range of all prefixes of the destination IP address be from length 1 to length L; let the counting bloom filter data structure correspond to more than two storage spaces respectively, and each unit block of the storage space The address is represented by the filter index index, and different storage spaces are respectively bound to different hash functions. The bit width of the space can be the same or different, and the address length can be the same or different. In this step, M can be an integer greater than or equal to 1, and the larger M is, the lower the probability of false positives occurring in subsequent searches, but limited by the storage space provided by the hardware, M can usually be up to 4 at most.
A11,在各存储空间中分别插入目的IP地址相关信息。A11, inserting information related to the destination IP address into each storage space.
在特定的存储空间中,对目的IP地址的所有前缀依次进行P2次哈希函数运算,每次哈希计算均能得到一个单元块的过滤器索引index,对各过滤器索引index出现的次数进行计数累加并将计数值填入该过滤器索引index对应的单元块中:In a specific storage space, P2 hash function operations are performed sequentially on all prefixes of the destination IP address, each hash calculation can obtain a filter index index of a unit block, and the number of occurrences of each filter index index is calculated The count is accumulated and the count value is filled into the unit block corresponding to the filter index index:
若目的IP地址当前长度前缀经某次哈希函数运算得到的过滤器索引index的计数值在累加前未达到计数值上限,则计数值加1;If the count value of the filter index index obtained by the current length prefix of the destination IP address through a hash function operation does not reach the upper limit of the count value before the accumulation, the count value will be increased by 1;
若目的IP地址当前长度前缀经某次哈希函数运算得到的过滤器索引index的计数值在累加前已达到计数值上限,,则不再累加计数值。不同位宽的存储空间中的单元块有不同的计数值上限,设M1为存储空间的位宽,那么该存储空间的计数值上限为2M1-1。If the count value of the filter index index obtained by the current length prefix of the destination IP address through a certain hash function operation has reached the upper limit of the count value before the accumulation, the count value is no longer accumulated. Unit blocks in storage spaces with different bit widths have different upper limit count values. Let M1 be the bit width of the storage space, then the upper limit count value of the storage space is 2 M1 -1.
A12,根据各存储空间中的计数值确定目的IP地址对应的结果集和地址集。A12. Determine the result set and address set corresponding to the destination IP address according to the count values in each storage space.
在各存储空间中对目的IP地址并行匹配得到对应的结果集和地址集。每个结果集和地址集均可以看成是长度为L的数组,结果集中置1的位对应地址集相应位置中填写的内容。The destination IP address is matched in parallel in each storage space to obtain a corresponding result set and address set. Each result set and address set can be regarded as an array with a length of L, and the bit set to 1 in the result set corresponds to the content filled in the corresponding position of the address set.
在每个存储空间中进行匹配的具体过程为:在一个特定的存储空间内,若对目的IP地址的某一个长度的前缀进行P2次哈希函数运算得到的P2个过滤器索引index对应的单元块中填写的计数值全部非0,则所述前缀在所述存储空间中匹配成功,将在长度为L的结果集中所述前缀的长度对应位置置1,并将P2个过滤器索引index对应的单元块中填写的计数值中最小者对应的过滤器索引index填入地址集中所述前缀的长度对应的位置(特殊的,如果该存储空间的位宽M=1,则在计数值为1的过滤器索引index任意选一个填入地址集中所述前缀的长度对应的位置);The specific process of matching in each storage space is: in a specific storage space, if P2 hash function operations are performed on a prefix of a certain length of the destination IP address, the units corresponding to P2 filter indexes are obtained. If the count values filled in the block are all non-zero, then the prefix is successfully matched in the storage space, and the corresponding position of the prefix length in the result set of length L is set to 1, and P2 filter indexes are corresponding to Fill in the filter index index corresponding to the minimum of the count values filled in the unit block of the address set to the position corresponding to the length of the prefix (specially, if the bit width M=1 of the storage space, then the count value is 1 The filter index index arbitrarily selects one to fill in the position corresponding to the length of the prefix in the address set);
若对目的IP地址的每一个长度的前缀进行P2次哈希函数运算得到的P2个过滤器索引index对应的单元块中填写的计数值至少有一个为0,则所述前缀在所述存储空间中匹配失败,将在长度为L的结果集中所述前缀的长度对应位置置0,同时在长度为L的地址集中所述前缀的长度对应位置赋0。If at least one of the count values filled in the unit blocks corresponding to the P2 filter index indexes obtained by performing P2 hash function operations on the prefix of each length of the destination IP address is 0, then the prefix is stored in the storage space If the matching fails, the position corresponding to the length of the prefix in the result set with length L is set to 0, and the position corresponding to the length of the prefix in the address set with length L is set to 0.
A13,将各存储空间分别对应的结果集相与之后得到与目的IP地址匹配的目标前缀。A13, after combining the result sets corresponding to each storage space, the target prefix matching the target IP address is obtained.
A2,根据目标前缀中置1的比特位对应的地址集中相应位置的过滤器索引index确定外部存储器地址为(2M-1)×index,其中,M为counting bloom filter数据结构对应的第一存储空间的位宽。A2, according to the filter index index of the corresponding position in the address set corresponding to the bit set in the target prefix, determine the external memory address as (2 M -1) × index, where M is the first storage corresponding to the counting bloom filter data structure The bit width of the space.
A3,通过步骤A2中确定的外部存储器地址访问外部存储器,获得目的IP地址对应的最长前缀(当外部存储器地址有两个以上时,经过比较获得目的IP地址对应的最长前缀),所述最长前缀所在的路由表项信息即为最终查找到的目的IP地址对应的路由表项信息。A3, access the external memory through the external memory address determined in step A2, and obtain the longest prefix corresponding to the destination IP address (when there are more than two external memory addresses, obtain the longest prefix corresponding to the destination IP address through comparison), the said The routing table entry information where the longest prefix is located is the routing table entry information corresponding to the finally found destination IP address.
步骤S104,将找到的目的IP地址对应的路由表项信息填入内部存储器中。Step S104, filling the routing entry information corresponding to the found destination IP address into the internal memory.
本发明第二实施例,一种路由查找装置,如图5所示,包括以下组成部分:In the second embodiment of the present invention, a routing search device, as shown in Figure 5, includes the following components:
1)存储操作单元10,用于基于counting bloom filter数据结构在外部存储器或者路由寻址芯片中存储路由表项信息。存储操作单元10,具体包括:1) The storage operation unit 10 is configured to store routing table entry information in an external memory or a routing addressable chip based on the counting bloom filter data structure. The storage operation unit 10 specifically includes:
第一存储操作模块11,用于基于counting bloom filter数据结构将路由表中的所有路由表项信息存入外部存储器,发生溢出时调用第二存储操作子模块。本发明所述路由查找装置可以在FPGA(Field-Programmable Gate Array,现场可编程门阵列)或ASIC(Application Specific Integrated Circuits,专用集成电路)芯片上实现,外部存储器可以为片外dram。The first storage operation module 11 is configured to store all routing table entry information in the routing table into the external memory based on the counting bloom filter data structure, and call the second storage operation submodule when overflow occurs. The routing search device of the present invention can be realized on FPGA (Field-Programmable Gate Array, field programmable gate array) or ASIC (Application Specific Integrated Circuits, application specific integrated circuit) chip, and the external memory can be off-chip dram.
具体的,设counting bloom filter数据结构对应一个位宽为M比特、地址长度为N比特的第一存储空间,M可取大于等于1的整数,且M越大,在后续的查找中发生假阳性falsepositive的概率越低,但是受硬件提供的存储空间的限制,M最大通常可以取到4。第一存储空间每一单元块可填入的数值为0、1、......、2M-1,第一存储空间的每一单元块地址用过滤器索引index表示。Specifically, let the counting bloom filter data structure correspond to a first storage space with a bit width of M bits and an address length of N bits. M can be an integer greater than or equal to 1, and the larger M is, the false positive will occur in the subsequent search. The lower the probability is, but limited by the storage space provided by the hardware, M can usually be up to 4 at most. The values that can be filled in each unit block of the first storage space are 0 , 1, .
第一存储操作模块11对路由表中的每一条路由表项信息中的前缀进行P1次哈希函数运算,每次哈希计算均能得到一个单元块的过滤器索引index,对各过滤器索引index出现的次数进行计数累加并将计数值填入该过滤器索引index对应的单元块中,计数值的初始值为0。The first storage operation module 11 performs P1 hash function operations on the prefix in each routing entry information in the routing table, and each hash calculation can obtain the filter index index of a unit block, and each filter index The number of occurrences of index is counted and accumulated, and the count value is filled into the unit block corresponding to the filter index index, and the initial value of the count value is 0.
若当前路由表项信息经某次哈希函数运算得到的过滤器索引index的计数值在累加前已为2M-1,则表示发生溢出,不再累加计数值,调用第二存储操作模块12;If the count value of the filter index index obtained by the current routing table item information through a hash function operation is 2M -1 before the accumulation, it means that overflow occurs, and the count value is no longer accumulated, and the second storage operation module 12 is called. ;
若对当前路由表项信息中的前缀经P1次哈希函数运算得到的过滤器索引index的计数值均未超过2M-1,选择计数值最小的过滤器索引index,在外部存储器中偏移地址为(2M-1)×index处填入该条路由表项信息。If the count value of the filter index index obtained by P1 hash function operations on the prefix in the current routing entry information does not exceed 2 M -1, select the filter index index with the smallest count value and offset it in the external memory The address is (2 M -1)×index and fill in the information of this routing entry.
第二存储操作模块12,用于将存入外部存储器过程中发生溢出的路由表项信息存入路由寻址芯片中。路由寻址芯片可以为TCAM。The second storage operation module 12 is configured to store routing table entry information overflowed during storage into the external memory into the routing addressing chip. The routing addressing chip may be a TCAM.
2)查找操作单元20,用于基于counting bloom filter数据结构从存储的路由表项信息中查找目的IP地址对应的路由表项信息。查找操作单元20,具体包括:2) The search operation unit 20 is configured to search the routing table entry information corresponding to the destination IP address from the stored routing table entry information based on the counting bloom filter data structure. Find the operating unit 20, specifically including:
第一查找操作模块21,用于在内部存储器中查找目的IP地址对应的路由表项信息,若找到,则操作结束,若未找到,则调用第二查找操作子模块。内部存储器可以为片内sram或者片内edram。The first search operation module 21 is used to search the routing entry information corresponding to the destination IP address in the internal memory. If found, the operation ends; if not found, the second search operation sub-module is invoked. The internal memory can be on-chip sram or on-chip edram.
第二查找操作模块22,用于基于counting bloom filter数据结构在外部存储器中查找目的IP地址对应的路由表项信息:若找到,则将找到的目的IP地址对应的路由表项信息填入内部存储器中;若未找到,则调用第三查找操作子模块。第二查找操作模块22,具体包括:The second search operation module 22 is used to search the routing table entry information corresponding to the destination IP address in the external memory based on the counting bloom filter data structure: if found, then fill the routing table entry information corresponding to the destination IP address found into the internal memory in; if not found, call the third search operation submodule. The second search operation module 22 specifically includes:
地址确定子模块221,用于基于counting bloom filter数据结构为目的IP地址匹配目标前缀,根据目标前缀中置1的比特位确定外部存储器地址。The address determination sub-module 221 is configured to match the target prefix for the destination IP address based on the counting bloom filter data structure, and determine the external memory address according to the bit set to 1 in the target prefix.
具体的,设目的IP地址的长度为L,目的IP地址的所有前缀的范围是从长度1到长度为L;设counting bloom filter数据结构分别对应两个以上的存储空间,所述存储空间的每一单元块地址用过滤器索引index表示,不同的存储空间分别绑定不同的哈希函数,为了便于实现,本实施例中不同的存储空间绑定的哈希函数的个数相同,均为P2。Specifically, let the length of the destination IP address be L, and the range of all prefixes of the destination IP address be from length 1 to length L; let the counting bloom filter data structure correspond to more than two storage spaces respectively, and each of the storage spaces A unit block address is represented by a filter index index, and different storage spaces are bound to different hash functions. In order to facilitate implementation, the number of hash functions bound to different storage spaces in this embodiment is the same, all of which are P2 .
在特定的存储空间中,对目的IP地址的所有前缀依次进行P2次哈希函数运算,每次哈希计算均能得到一个单元块的过滤器索引index,对各过滤器索引index出现的次数进行计数累加并将计数值填入该过滤器索引index对应的单元块中:In a specific storage space, P2 hash function operations are performed sequentially on all prefixes of the destination IP address, each hash calculation can obtain a filter index index of a unit block, and the number of occurrences of each filter index index is calculated The count is accumulated and the count value is filled into the unit block corresponding to the filter index index:
若当前路由表项信息经某次哈希函数运算得到的过滤器索引index的计数值在累加前未达到计数值上限,则计数值加1;If the count value of the filter index index obtained by a hash function operation on the current routing entry information does not reach the upper limit of the count value before the accumulation, the count value will be increased by 1;
若当前路由表项信息经某次哈希函数运算得到的过滤器索引index的计数值在累加前已达到计数值上限,则不再累加计数值;不同位宽的存储空间中的单元块有不同的计数值上限,设M1为存储空间的位宽,那么该存储空间的计数值上限为2M1-1。在各存储空间中对目的IP地址并行匹配得到对应的结果集和地址集;If the count value of the filter index index obtained by the current routing entry information through a certain hash function operation has reached the upper limit of the count value before the accumulation, the count value will not be accumulated; the unit blocks in storage spaces with different bit widths have different The upper limit of the count value of , if M1 is the bit width of the storage space, then the upper limit of the count value of the storage space is 2 M1 -1. Parallel matching of destination IP addresses in each storage space to obtain corresponding result sets and address sets;
将各存储空间分别对应的结果集相与之后得到与目的IP地址匹配的目标前缀。After ANDing the result sets corresponding to each storage space, the target prefix matching the target IP address is obtained.
根据目标前缀中置1的比特位对应的地址集中相应位置的过滤器索引index确定外部存储器地址为(2M-1)×index,其中,M为counting bloom filter数据结构对应的第一存储空间的位宽。According to the filter index index of the corresponding position in the address set corresponding to the bit set in the target prefix, determine the external memory address as (2 M -1) × index, where M is the first storage space corresponding to the counting bloom filter data structure bit width.
前缀确定子模块222,用于通过外部存储器地址访问外部存储器,获得目的IP地址对应的最长前缀(当外部存储器地址有两个以上时,经过比较获得目的IP地址对应的最长前缀),所述最长前缀所在的路由表项信息即为最终查找到的目的IP地址对应的路由表项信息。The prefix determination submodule 222 is used to access the external memory through the external memory address to obtain the longest prefix corresponding to the destination IP address (when there are more than two external memory addresses, obtain the longest prefix corresponding to the destination IP address through comparison), so The routing table entry information where the longest prefix is located is the routing table entry information corresponding to the finally found destination IP address.
第三查找操作模块23,用于与第二查找操作模块22同时启动,在路由寻址芯片中查找并将找到的目的IP地址对应的路由表项信息填入内部存储器中。The third search operation module 23 is configured to start at the same time as the second search operation module 22, search in the routing addressing chip and fill in the routing entry information corresponding to the found destination IP address into the internal memory.
比较模块24,用于当第二查找操作模块22和第三查找操作模块23均查找到路由表项信息时,将其中具有较长前缀者作为目的IP地址对应的路由表项信息,并填入内部存储器中,若与上述两个查找模块填写的结果不同,则以比较模块24的结果为准。The comparison module 24 is used for when the second search operation module 22 and the third search operation module 23 both find the routing table entry information, use the one with the longer prefix as the routing table entry information corresponding to the destination IP address, and fill in In the internal memory, if it is different from the results filled in by the above two search modules, the result of the comparison module 24 shall prevail.
需要说明的是,本发明中只存在1)第二查找操作模块或者第三查找操作模块中两者之一查找到目的IP地址对应的路由表项信息;2)第二查找操作模块和第三查找操作模块均查找到目的IP地址对应的路由表项信息,这两种情况。It should be noted that there are only 1) in the present invention, one of the second search operation module or the third search operation module finds the routing table entry information corresponding to the destination IP address; 2) the second search operation module and the third search operation module The search operation module finds the routing table entry information corresponding to the destination IP address, in both cases.
本发明提供的路由查找方案,与现有的查找方法相比,有以下优势:1)由于基于counting bloom filter数据结构,数据结构初始化后不随路由表项增加而增大,存储消耗很小且易于管理;2)在片内确定片外dram的偏移地址的过程只需消耗相当于一次片内sram的访问时间,极大的提高了路由查找速率。Compared with the existing search methods, the routing search solution provided by the present invention has the following advantages: 1) because it is based on the counting bloom filter data structure, the data structure does not increase with the increase of routing table items after initialization, and the storage consumption is very small and easy Management; 2) The process of determining the offset address of the off-chip dram in the chip only needs to consume the access time equivalent to one on-chip sram, which greatly improves the routing search rate.
本发明第三实施例,一种路由查找装置,本实施例与第二实施例大致相同,区别在于,查找操作单元20的具体组成及其所完成的功能,其中不涉及在内部存储器的查找,具体的,如图6所示,查找操作单元20,具体包括:The third embodiment of the present invention is a routing search device. This embodiment is substantially the same as the second embodiment. The difference is that the specific composition of the search operation unit 20 and its completed functions do not involve the search in the internal memory. Specifically, as shown in FIG. 6, the search operation unit 20 specifically includes:
第一查找操作模块41,用于基于counting bloom filter数据结构在外部存储器中查找目的IP地址对应的路由表项信息。The first search operation module 41 is configured to search the external memory for routing entry information corresponding to the destination IP address based on the counting bloom filter data structure.
第二查找操作模块42,用于与第二查找操作模块22同时启动,在路由寻址芯片中查找到目的IP地址。The second search operation module 42 is configured to start simultaneously with the second search operation module 22 to find the destination IP address in the routing addressing chip.
比较模块24,用于当第二查找操作模块22和第三查找操作模块23均查找到路由表项信息时,将其中具有较长前缀者作为目的IP地址对应的路由表项信息,并填入内部存储器中,若与上述两个查找模块填写的结果不同,则以比较模块24的结果为准。The comparison module 24 is used for when the second search operation module 22 and the third search operation module 23 both find the routing table entry information, use the one with the longer prefix as the routing table entry information corresponding to the destination IP address, and fill in In the internal memory, if it is different from the results filled in by the above two search modules, the result of the comparison module 24 shall prevail.
因为内部存储器的访问速度快,但是容量较小,第二实施例中将已查找到的目的IP地址对应的下一跳信息放入内部存储器中,在后续查找时首先访问内部存储器可以进一步提高查找的效率,故本实施例的查找效率低于第二实施例中的查找效率。Because the access speed of the internal memory is fast, but the capacity is small, in the second embodiment, the next hop information corresponding to the destination IP address that has been searched is put into the internal memory, and the internal memory can be further improved by first accessing the internal memory during the subsequent search. Therefore, the search efficiency in this embodiment is lower than that in the second embodiment.
本发明第四实施例,以采用counting bloom filter数据结构对应的三个特定的存储空间为例,介绍一下在片外dram中进行路由存储和查找的过程:In the fourth embodiment of the present invention, taking three specific storage spaces corresponding to the counting bloom filter data structure as an example, the process of routing storage and searching in the off-chip dram is introduced:
第一、二存储空间位宽为1,地址长度为10,其结构如图7(a)所示,这两个存储空间中每个单元块(图中的一个方框为一个单元块)为1个bit,初始值均为0。The bit width of the first and second storage spaces is 1, and the address length is 10. Its structure is shown in Figure 7(a). Each unit block (a box in the figure is a unit block) in these two storage spaces is 1 bit, the initial value is 0.
第三存储空间位宽为位宽为2,地址长度为10,其结构如图7(b)所示,第三存储空间中每个单元块(图中上下两个方框为一个单元块)为2个bit,初始值均为00,每个单元块可表示的二进制计数值为00、01、10、11,分别对应十进制计数值0、1、2、3。The bit width of the third storage space is that the bit width is 2, and the address length is 10. Its structure is shown in Figure 7(b). Each unit block in the third storage space (the upper and lower boxes in the figure are a unit block) It is 2 bits, the initial value is 00, and the binary count values that each unit block can represent are 00, 01, 10, and 11, which correspond to the decimal count values 0, 1, 2, and 3, respectively.
为保证系统整体false positive为10-4,上述三个存储空间共需12个哈希函数,每个存储空间对应4个哈希函数、32个前缀长度,某个存储空间对应的哈希函数可任选,与其他两个存储空间不一样即可。In order to ensure that the overall false positive of the system is 10 -4 , the above three storage spaces require a total of 12 hash functions, and each storage space corresponds to 4 hash functions and 32 prefix lengths. The hash function corresponding to a certain storage space can be Optional, it can be different from the other two storage spaces.
一、插入路由表项形成转发结构:1. Insert routing table entries to form a forwarding structure:
1)基于counting bloom filter数据结构将路由表中的所有路由表项信息存入片外dram,将存入片外dram过程中发生溢出的路由表项信息存入TCAM中。1) Based on the counting bloom filter data structure, store all the routing table item information in the routing table into the off-chip dram, and store the routing table item information that overflows during the process of storing into the off-chip dram into the TCAM.
对于第三存储空间,对路由表中的每一条路由表项信息中的前缀进行4次哈希函数运算,每一条路由表项信息包含前缀和下一跳信息。For the third storage space, four hash function operations are performed on the prefix in each piece of routing table information in the routing table, and each piece of routing table information includes prefix and next hop information.
每次哈希命中第三存储空间的过滤器索引index后,将该过滤器索引index的计数值加1,并填入对应的单元块中。因为每个单元块中的初始化计数值为0,若没有该单元块对应的过滤器索引index命中,则计数值不变。Each time the hash hits the filter index index of the third storage space, the count value of the filter index index is increased by 1, and filled into the corresponding unit block. Because the initialization count value in each unit block is 0, if the filter index index corresponding to the unit block is not hit, the count value remains unchanged.
当前某个过滤器索引index的计数值小于3时,若某次哈希命中该过滤器索引index,则计数值加1,由于第三存储空间每个单元块最多只能标记3个非0的计数值,这样,外部dram的地址长度为第三存储空间过滤器索引index总长度的3(即通过22-1计算得出)倍,因此,将命中的该过滤器索引index×3作为片外dram的偏移地址,在片外dram的index×3至index×3+2的地址范围中插入当前哈希运算的路由表项信息即可。第三存储空间的过滤器索引index与片外dram的偏移地址的对应关系如图8所示。When the count value of a current filter index index is less than 3, if a certain hash hits the filter index index, the count value will be increased by 1, because each unit block of the third storage space can only mark up to 3 non-zero Count value, so that the address length of the external dram is 3 times the total length of the filter index index of the third storage space (that is, calculated by 2 2 -1), therefore, the hit filter index index×3 is used as a slice For the offset address of the external dram, insert the routing entry information of the current hash operation into the address range from index×3 to index×3+2 of the off-chip dram. The corresponding relationship between the filter index index of the third storage space and the offset address of the off-chip dram is shown in FIG. 8 .
当前某个过滤器索引index的计数值小于3时,表示第三存储空间中的该单元块已满,若某次哈希命中该过滤器索引index,则发生溢出,不再累加计数值,并将该路由表项信息(包含前缀与下一跳信息)插入TCAM。根据实验统计,这部分溢出路由表项占到整个路由表表项的0.1%。When the count value of the current filter index index is less than 3, it means that the unit block in the third storage space is full. If a certain hash hits the filter index index, overflow occurs, and the count value is no longer accumulated, and Insert the routing table entry information (including prefix and next hop information) into the TCAM. According to experimental statistics, this part of overflow routing table entries accounts for 0.1% of the entire routing table entries.
片外dram的地址冗余可以降低溢出概率即降低TCAM的插入条数,同时为了降低第三存储空间发生假阳性false positive造成的流水中断,可将dram颗粒冗余,即在片外附加两片存储相同内容的片外dram,同时查找一个前缀对应的两个偏移地址时信息,可有效降低中断概率。The address redundancy of the off-chip DRAM can reduce the probability of overflow, that is, the number of TCAM insertions. At the same time, in order to reduce the interruption of the flow caused by false positives in the third storage space, the DRAM particles can be redundant, that is, add two chips outside the chip. When storing the off-chip dram with the same content, and searching for the information of two offset addresses corresponding to a prefix at the same time, it can effectively reduce the probability of interruption.
2)基于counting bloom filter数据结构将目的IP地址中的所有长度的前缀均经过4次哈希函数运算,根据哈希函数运算结果插入第一、二存储空间。2) Based on the counting bloom filter data structure, the prefixes of all lengths in the destination IP address are subjected to four hash function operations, and inserted into the first and second storage spaces according to the hash function operation results.
第一、二存储空间各单元块的初始化计数值均为0,将目的IP地址所有长度的前缀分别经过4次哈希函数运算到不同的过滤器索引index(4次哈希可保证存储空间发生falsepositive的概率为0.05):The initial count value of each unit block in the first and second storage spaces is 0, and the prefixes of all lengths of the destination IP address are respectively subjected to 4 times of hash function operations to different filter indexes (4 times of hashing can ensure that the storage space The probability of false positive is 0.05):
若目的IP地址当前长度前缀经某次哈希函数运算得到的过滤器索引index的计数值在累加前为0,则计数值加1;If the count value of the filter index index obtained by the current length prefix of the destination IP address through a certain hash function operation is 0 before the accumulation, the count value is increased by 1;
若目的IP地址当前长度前缀经某次哈希函数运算得到的过滤器索引index的计数值在累加前已为非0,则不再累加计数值。If the count value of the filter index index obtained by a certain hash function operation of the current length prefix of the destination IP address is non-zero before the accumulation, the count value is no longer accumulated.
二、找到给定目的IP地址的下一跳信息:2. Find the next hop information for a given destination IP address:
1)匹配目的IP地址的目标前缀。1) Match the destination prefix of the destination IP address.
在第一、二存储空间中并行查找。在每个特定的存储空间中,将该目的IP地址的每个前缀(从长度为1到长度为32)进行匹配,结束后产生一个32bits的结果集。对于其中任一个长度前缀,若经过4次哈希函数计算得到的4个结果对应的过滤器索引index全部非0,则证明该前缀在该存储空间中匹配成功,该前缀在结果集对应地址置1(可将结果集视为长度为32位、下标从0开始的数组,若长度为k的前缀命中,则结果集的第k-1位置1),并将4个结果对应的过滤器索引index中计数值中最小者填入该前缀在地址集中对应的位置;Search in parallel in the first and second storage spaces. In each specific storage space, each prefix (from length 1 to length 32) of the destination IP address is matched, and a 32bits result set is generated after completion. For any of the length prefixes, if the filter indexes corresponding to the 4 results obtained through 4 hash function calculations are all non-zero, it proves that the prefix is successfully matched in the storage space, and the prefix is set in the corresponding address of the result set. 1 (The result set can be regarded as an array with a length of 32 bits and subscripts starting from 0. If the prefix with a length of k is hit, the k-1th position of the result set is 1), and the filter corresponding to the 4 results Fill in the corresponding position of the prefix in the address set with the smallest count value in the index index;
若4个结果对应的过滤器索引index中只要有一个为0,则该前缀不命中,该前缀在结果集对应位置0。If only one of the filter indexes corresponding to the 4 results is 0, the prefix is not matched, and the corresponding position of the prefix is 0 in the result set.
2)将两个存储空间对应的结果集相与之后得到最终结果集,即目标前缀。2) The result sets corresponding to the two storage spaces are combined to obtain the final result set, which is the target prefix.
3)根据目标前缀在dram中查找最长前缀及下一跳信息。3) Find the longest prefix and next hop information in dram according to the target prefix.
根据目标前缀中置1的比特位对应的地址集中相应位置的过滤器索引index确定片外dram地址为3×index(3是通过22-1计算得出)。According to the filter index index of the corresponding position in the address set corresponding to the bit set to 1 in the target prefix, the off-chip dram address is determined to be 3×index (3 is calculated by 2 2 -1).
通过地址3×index访问片外dram,由于在第一步中存在溢出的路由表项没有插入到片外dram而是插入了TCAM中,同时也对该目的IP地址进行TCAM查找,即查找结果可能会出现在TCAM或片外dram中,但由于TCAM中只插入了总表项的0.1%,因此,对于性能影响较小。经过比较获得目的IP地址对应的最长前缀,该最长前缀所在的路由表项信息即为最终查找到的目的IP地址对应的路由表项信息。Access the off-chip dram through the address 3×index. In the first step, the overflow routing table entry is not inserted into the off-chip dram but inserted into the TCAM. At the same time, the TCAM search is performed on the destination IP address, that is, the search result may be It will appear in TCAM or off-chip dram, but since only 0.1% of the total entries are inserted in TCAM, the impact on performance is small. The longest prefix corresponding to the destination IP address is obtained through comparison, and the routing table entry information where the longest prefix is located is the routing table entry information corresponding to the finally found destination IP address.
另外,若采用两个片外dram并行查找,目标前缀中最长及次长前缀都出现falsepositive的概率为10-4×10-4=10-8,即流水中断的概率为10-8。In addition, if two off-chip drams are used to search in parallel, the probability that both the longest and the second-longest prefixes in the target prefix appear false positive is 10 -4 ×10 -4 = 10 -8 , that is, the probability of pipeline interruption is 10 -8 .
本发明第五实施例,在上述四个实施例的基础上介绍一个路由表项插入和查找的实例,本实例采用四个counting bloom filter数据结构的存储空间,不同的存储空间分别绑定不同的哈希函数。The fifth embodiment of the present invention introduces an example of inserting and searching routing entries on the basis of the above four embodiments. This example uses four storage spaces of the counting bloom filter data structure, and different storage spaces are bound to different hash function.
路由表项格式为:(前缀,下一跳信息即端口号)。The format of the routing table entry is: (prefix, next hop information is the port number).
假设存在路由表项:(10.10.*.*/16,5),(10.*.*.*/8,2),其中,前缀10.10.*.*以pre1代替,前缀10.*.*.*以pre2代替:Suppose there are routing table entries: (10.10.*.*/16, 5), (10.*.*.*/8, 2), where the prefix 10.10.*.* is replaced by pre1, and the prefix 10.*.* .* replace with pre2:
pre1插入第一存储空间的过滤器索引index为[2(1),4(3),6(2),7(2)],最后一组小括号内的数字表示计数值,则根据最小计数值原则,应该选择地址2,则片外dram的偏移地址为2×3=6,没有溢出(地址2的计数值为1,表明片外dram只插入了1项,共可以插入3项,因此没有溢出),则前缀存储在片外dram的偏移地址为6处。The index index of the filter inserted into the first storage space by pre1 is [2(1), 4(3), 6(2), 7(2)], and the numbers in the last group of parentheses indicate the count value, then the minimum count Value principle, address 2 should be selected, then the offset address of the off-chip dram is 2×3=6, there is no overflow (the count value of address 2 is 1, indicating that only one item is inserted in the off-chip dram, a total of 3 items can be inserted, Therefore, there is no overflow), the prefix is stored at the offset address of off-chip dram at 6.
pre2插入第一存储空间的过滤器索引index为[3(2),4(3),2(2),7(1)],最后一组小括号内的数字表示计数值,则根据最小计数值原则,应该选择地址7,则片外dram的偏移地址为7×3=21,没有溢出,则前缀存储在片外dram的偏移地址为21处。The index index of the filter inserted into the first storage space by pre2 is [3(2), 4(3), 2(2), 7(1)], and the numbers in the last group of parentheses indicate the count value, and the minimum count Value principle, address 7 should be selected, then the offset address of the off-chip dram is 7×3=21, if there is no overflow, the prefix is stored at the offset address of the off-chip dram at 21.
假设对于待匹配的目的IP地址:IP1(10.10.10.10),IP2(11.10.10.10):Suppose for the destination IP address to be matched: IP1(10.10.10.10), IP2(11.10.10.10):
IP1的32个前缀在第二~第四存储空间中并行匹配后得到的三个结果集,将三个结果集相与之后得到一个32bit的目标前缀,假设有两个片外dram,则取目标前缀中较高命中置1位--第16位和第8位在地址集中相应位的计数值乘以3得到片外dram的偏移地址6和21,访问两个片外dram,取得两条前缀及下一跳信息,经过比较后,pre1为真正最长前缀,则将携带该目的IP地址的数据包转发至5号端口。The three result sets obtained after the 32 prefixes of IP1 are matched in parallel in the second to fourth storage spaces, and a 32-bit target prefix is obtained after the three result sets are combined. Assuming that there are two off-chip drams, the target is taken The higher hit in the prefix is set to 1--the count value of the 16th bit and the 8th bit in the address set is multiplied by 3 to obtain the offset address 6 and 21 of the off-chip dram, access two off-chip drams, and obtain two Prefix and next hop information, after comparison, pre1 is the real longest prefix, then the data packet carrying the destination IP address is forwarded to port 5.
假设出现了false positive,IP2命中了pre2,则IP2对应的目标前缀第8位命中置1,发现取偏移地址21访问片外dram后得到的前缀与IP2不符。若TCAM中也未找到,则降低目标前缀命中置1位的位置,即取低于第8位的命中置1位计算偏移地址,继续在片外dram以及TCAM中查找,依次类推,最终也须取前缀较长者作为路由查找结果。Assuming a false positive occurs and IP2 hits pre2, the 8th bit of the target prefix corresponding to IP2 hits and is set to 1. It is found that the prefix obtained after accessing the off-chip dram by taking the offset address 21 does not match IP2. If it is not found in TCAM, reduce the position of the target prefix hit set bit, that is, take the hit set bit lower than the 8th bit to calculate the offset address, continue to search in the off-chip dram and TCAM, and so on, and finally The one with the longer prefix must be taken as the route lookup result.
通过具体实施方式的说明,应当可对本发明为达成预定目的所采取的技术手段及功效得以更加深入且具体的了解,然而所附图示仅是提供参考与说明之用,并非用来对本发明加以限制。Through the description of the specific implementation, it should be possible to gain a deeper and more specific understanding of the technical means and effects of the present invention to achieve the intended purpose. However, the attached drawings are only for reference and description, and are not used to explain the present invention. limit.
Claims (6)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201110211927.6A CN102271087B (en) | 2011-07-27 | 2011-07-27 | A kind of method for searching route and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201110211927.6A CN102271087B (en) | 2011-07-27 | 2011-07-27 | A kind of method for searching route and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN102271087A CN102271087A (en) | 2011-12-07 |
| CN102271087B true CN102271087B (en) | 2017-09-29 |
Family
ID=45053254
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201110211927.6A Expired - Fee Related CN102271087B (en) | 2011-07-27 | 2011-07-27 | A kind of method for searching route and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN102271087B (en) |
Families Citing this family (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102333036B (en) * | 2011-10-17 | 2015-06-03 | 中兴通讯股份有限公司 | Method and system for realizing high-speed routing lookup |
| CN103973571A (en) * | 2013-02-05 | 2014-08-06 | 中兴通讯股份有限公司 | Network processor and routing searching method |
| CN104239337B (en) * | 2013-06-19 | 2019-03-26 | 中兴通讯股份有限公司 | Table lookup processing method and device based on TCAM |
| WO2015081524A1 (en) * | 2013-12-05 | 2015-06-11 | 北京大学深圳研究生院 | Method and apparatus for forwarding heterogeneous address route |
| CN107204926B (en) * | 2017-05-16 | 2021-06-11 | 上海博达数据通信有限公司 | Rapid route searching method for preprocessing cache |
| CN111782561B (en) * | 2020-09-07 | 2020-12-04 | 新华三半导体技术有限公司 | SRAM storage space allocation method, device and chip |
| CN112769704B (en) * | 2021-02-09 | 2023-04-18 | 芯河半导体科技(无锡)有限公司 | High-speed extensible IP route lookup hardware device based on hash table |
| CN113872863B (en) * | 2021-08-25 | 2023-04-18 | 优刻得科技股份有限公司 | Path searching method and device |
| CN113824814B (en) * | 2021-09-23 | 2023-04-25 | 新华三信息安全技术有限公司 | Address matching method, device, network equipment and medium of forwarding table |
| CN113986818B (en) * | 2021-12-30 | 2022-04-08 | 中科声龙科技发展(北京)有限公司 | Chip address reconstruction method, chip, electronic device and storage medium |
| CN115412893B (en) * | 2022-10-19 | 2023-04-21 | 成都锐成芯微科技股份有限公司 | Low-power-consumption Bluetooth attribute access method and low-power-consumption Bluetooth system |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1585358A (en) * | 2003-08-19 | 2005-02-23 | 华为技术有限公司 | Route searching method and system |
| CN101150483A (en) * | 2007-11-02 | 2008-03-26 | 华为技术有限公司 | Routing table adjustment method, routing query method and device, and routing table storage device |
-
2011
- 2011-07-27 CN CN201110211927.6A patent/CN102271087B/en not_active Expired - Fee Related
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1585358A (en) * | 2003-08-19 | 2005-02-23 | 华为技术有限公司 | Route searching method and system |
| CN101150483A (en) * | 2007-11-02 | 2008-03-26 | 华为技术有限公司 | Routing table adjustment method, routing query method and device, and routing table storage device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN102271087A (en) | 2011-12-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN102271087B (en) | A kind of method for searching route and device | |
| US8625604B2 (en) | Hash-based prefix-compressed trie for IP route lookup | |
| CN102377664B (en) | TCAM (ternary content addressable memory)-based range matching device and method | |
| Eatherton et al. | Tree bitmap: hardware/software IP lookups with incremental updates | |
| CN100470550C (en) | A method for storing information, a method for searching for information, and an engine device | |
| Bando et al. | FlashTrie: beyond 100-Gb/s IP route lookup using hash-based prefix-compressed trie | |
| US20190058661A1 (en) | Storing keys with variable sizes in a multi-bank database | |
| US9424366B1 (en) | Reducing power consumption in ternary content addressable memory (TCAM) | |
| CN101834802B (en) | Method and device for forwarding data packet | |
| CN101594319B (en) | Entry lookup method and entry lookup device | |
| CN102333036B (en) | Method and system for realizing high-speed routing lookup | |
| US8848707B2 (en) | Method for IP longest prefix match using prefix length sorting | |
| CN101350788B (en) | Method for mixed loop-up table of network processor inside and outside | |
| CN100536435C (en) | Binary tree-based stream classification checking method | |
| US8966167B1 (en) | Content search system having multiple pipelines | |
| CN1787477A (en) | Method for searching IPv6 routing table | |
| CN104301227B (en) | High-speed low-power-consumption IP route table lookup method based on TCAM | |
| CN115473846A (en) | Retrieval method and related device for router forwarding information | |
| CN1529454A (en) | Parallel route lookup method and system for eliminating longest prefix match lookup | |
| WO2022206397A1 (en) | Buffering method and integrated circuit | |
| US10476785B2 (en) | IP routing search | |
| CN112115312B (en) | Data name searching method, system and storage medium | |
| JP2006246488A (en) | Network router, address processing method, and computer program | |
| CN102882798B (en) | Statistical counting method facing to backbone network flow analysis | |
| Jing et al. | An Efficient Name Look-up Architecture Based on Binary Search in NDN Networking |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| EE01 | Entry into force of recordation of patent licensing contract |
Application publication date: 20111207 Assignee: SANECHIPS TECHNOLOGY Co.,Ltd. Assignor: ZTE Corp. Contract record no.: 2015440020319 Denomination of invention: Routing search method and device License type: Common License Record date: 20151123 |
|
| LICC | Enforcement, change and cancellation of record of contracts on the licence for exploitation of a patent or utility model | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170929 |