WO2010127536A1 - 网络处理器使用的建表和查表方法 - Google Patents

网络处理器使用的建表和查表方法 Download PDF

Info

Publication number
WO2010127536A1
WO2010127536A1 PCT/CN2009/074855 CN2009074855W WO2010127536A1 WO 2010127536 A1 WO2010127536 A1 WO 2010127536A1 CN 2009074855 W CN2009074855 W CN 2009074855W WO 2010127536 A1 WO2010127536 A1 WO 2010127536A1
Authority
WO
WIPO (PCT)
Prior art keywords
entry
index value
matching
value
matching bit
Prior art date
Application number
PCT/CN2009/074855
Other languages
English (en)
French (fr)
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 中兴通讯股份有限公司
Priority to EP09844288.2A priority Critical patent/EP2429132B1/en
Priority to US13/318,602 priority patent/US20120054198A1/en
Publication of WO2010127536A1 publication Critical patent/WO2010127536A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9017Indexing; Data structures therefor; Storage structures using directory or table look-up
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/54Organization of routing tables
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/7453Address table lookup; Address filtering using hashing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/748Address table lookup; Address filtering using longest matching prefix

Definitions

  • the present invention relates to the field of network communications, and more particularly to a table construction and table lookup method used by a network processor.
  • BACKGROUND With the development of information technology, the amount of data traffic is getting higher and higher, and the processing of different data protocols and data types is more and more complicated. Therefore, network nodes are required to have the capability of flexibly processing data services.
  • the current network processor can customize the business process according to requirements. Compared with the original business chip, it has the advantages of flexibility, easy upgrade and short development cycle, and has been widely used in recent years.
  • the processing of data by the network processor generally includes: flow classification, rate limiting, traffic management and shaping, and message modification.
  • the network processor needs to obtain information from the data. After obtaining the information in the data packet, look up the table and judge what kind of processing the data packet is based on the result of the lookup table.
  • the processing efficiency of the network processor will be affected, resulting in a decrease in performance.
  • the current table design and table lookup methods used by network processors are as follows:
  • the longest matching algorithm compares one bit at a time, until it finds ⁇ " exact match, it needs to compare n times to identify whether it is the most suitable match. Whether it is the most accurate match or the longest prefix match, the number table creation guarantees only A best match.
  • the tree to be accessed is hierarchically placed in the memory, the first part of the data of the number table is placed in the first level of memory, the second part is placed in the second level of memory, and so on. .
  • the processor determines one or more matches stored between the memory level and the input search term by one or more portions stored in the memory level.
  • the processor, the first memory level and the second memory level are implemented on an integrated circuit, and the third memory level is implemented external to the integrated circuit.
  • some look-up tables are compared by bit-by-bit comparison, some use a hash algorithm to calculate a key value, or a combination of the above two methods, or a hierarchical table-level hierarchical look-up table.
  • the method of comparing bit by bit when the number of matched bits is large, the number of times of comparison needs to be large, and the method of matching by hash algorithm may cause conflict, and it is easy to cause performance degradation.
  • the matching length mentioned here refers to the matching byte length of the tree table entry or the length of the field to be matched.
  • t ⁇ has a maximum length of 16 bits ⁇ Table ⁇ Table entry: 0101001110******, its The length is 1 Obit, 6bit is wildcard. If an input field is: 10101010********, the matching field is 10101010, and the matching length is 8bit.
  • the object of the present invention is to overcome the deficiencies of the prior art, and to disclose a table construction and table lookup method used by a network processor, simplifying the table lookup process of the network processor, and improving the processing capability of the network processor.
  • a table with a fixed length of bytes is especially effective.
  • the method for constructing a table used by a network processor according to the present invention is configured to configure a table entry, and calculate a storage index value according to a matching bit length and a matching bit value of the foregoing entry, and then determine the foregoing entry according to the storage index value. Storage area.
  • the method for constructing a table used by the network processor disclosed by the present invention further includes the following subordinate technical features: the method for calculating the index value is to use a partial mapping algorithm, or use a full mapping algorithm; or use a hash function to calculate; Determining the storage area of the entry includes: determining, according to the matching bit length of the foregoing entry, the stored area, and the entry having the same matching bit length is determined according to the matching bit value. The location stored in the same area; Let N be the storage index value of the above table entry, and the above formula for storing the index value is:
  • N X/M + (S-1) where X is the matching bit value of the above entry, M is the modulus, and S is the matching bit length of the above entry.
  • the value of modulo M is 1024.
  • the invention also discloses a table lookup method used by the network processor, which is used for matching entries, and calculates an index value of the corresponding entry according to the matching bit length and the matching bit value of the input field, and then according to the index value of the corresponding entry. In the storage area of the above table, the entry with the same index value is searched, and the input field matches the above-mentioned entry with the same index value one by one. If there is an exact match of the above entry, the search is returned, otherwise the search fails.
  • the table lookup method used by the network processor disclosed in the present invention further includes the following subordinate technical features: the method for calculating the index value of the corresponding entry is to use a partial mapping algorithm, or use a full mapping algorithm; or use a hash function to calculate;
  • the index value of the entry is the matching bit length and the matching bit value of the input field.
  • the foregoing searching for the entry having the same index value includes: determining the storage area of the entry according to the matching bit length of the input field, in the same matching bit length In the entry of the entry, the location in the same area is determined according to the matching bit value of the input field; N is the index value of the corresponding entry, and the formula for calculating the index value of the corresponding entry is:
  • N X/M + (S-1) where X is the matching bit value of the above entry, M is the modulo, and S is the matching bit length of the above entry.
  • the value of the modulo M is 1024.
  • FIG. 1 is a flow chart of a method for constructing a table and a table lookup method for a network processor according to an embodiment of the present invention.
  • 2 is a schematic diagram of a storage structure of a network processor table according to an embodiment of the present invention.
  • 3 is a schematic diagram of a storage structure embodiment of a table and a table lookup method thereof according to the present invention.
  • FIG. 4 is a schematic diagram of another storage structure of a network processor table according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a storage structure embodiment of a table and a table lookup method thereof according to the present invention.
  • BEST MODE FOR CARRYING OUT THE INVENTION will be described in detail with reference to the accompanying drawings. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
  • 1 is a flow chart of a method for constructing a table and a table lookup method for a network processor according to an embodiment of the present invention. As shown in FIG.
  • the method for constructing a table and the method for checking a table according to the embodiment of the present invention mainly include: firstly constructing a table, including a configuration entry, that is, storing an entry according to the length of the matching bit and the value of the matching bit. .
  • the corresponding entry index value is calculated according to the input matching data.
  • the index value can be calculated using a full mapping algorithm or a partial mapping algorithm such as a hash algorithm.
  • the index value of the entry it is determined whether there is a corresponding entry in the table. When there is no corresponding entry in the table, the flag indicating that the table fails to be checked ends the current lookup table, waiting for a new lookup table requirement. If the corresponding entry exists in the table, it is further determined whether the corresponding entry is unique. If the corresponding entry is unique, further comparison is performed bit by bit, and the matching is successful. If the matching succeeds, the flag indicating that the table is successful is ended. This checklist waits for the new lookup table requirement; if the match is unsuccessful, it returns the checklist failure flag to end the checklist, waiting for the new lookup table requirement. If the corresponding entry is not unique, the input matching data and the conflicting item are compared one by one by bit.
  • FIG. 2 is a schematic diagram of a storage structure of a network processor table according to an embodiment of the present invention. As shown in Figure 2, the entries with different matching lengths are stored in different areas. The maximum matching length is 16-bit. The entries with different matching lengths are placed in different areas. The figure shows 4bit, 8bit, and 3bit. Area i or. The Key in Figure 2 is used to represent an index value, and key1 and key2 are used to distinguish different indexes.
  • the matching bit value is stored as the area index value.
  • the key value minus 1 corresponds to the area i or index value
  • the Index value is the index value.
  • the storage positions of 0000, 0001, 0010, and 0100 correspond to 0, 1, 2, and 4.
  • the length of the match is 8 or greater.
  • the hash value is divided by 128 according to the matching bit value of the entry.
  • index5 has two entries, which belong to the conflicting term.
  • the matching bit value of the so-called entry is the value corresponding to the bit length of the matching length, which is 3 ⁇ 4.
  • the matching value of 011** is 011, and the corresponding decimal value is 3.
  • FIG. 3 is a schematic diagram of a storage structure embodiment of a table and a table lookup method thereof according to the present invention.
  • the storage structure of the table shown in the drawing is an embodiment of the storage structure of the table shown in FIG. 2.
  • the following is an example of the two input values divided by 'J is 00000001******** and 00000101********, to illustrate the table lookup process of the present invention: 1. Determine the table according to the input matching length The 8bit area is searched.
  • mapping algorithm determine that the hash values of the two inputs are 1 and 5, respectively.
  • the mapping algorithm used here is to perform hash mapping by dividing the matching bit value of the table entry by 128.
  • 4 is a schematic diagram of another storage structure of a network processor table according to an embodiment of the present invention.
  • the index is calculated according to the matching length and the matching value to store the entry.
  • the table shows the table with the maximum matching length of 16 bits.
  • the entries are stored in the order of matching length and matching value.
  • the entries with the same matching length are stored in the same group.
  • the entries with the same matching length are in the order according to the matching value. Store.
  • the position where the entry is stored is judged based on the calculated value of the matching length and the matching value.
  • FIG. 5 is a schematic diagram of a storage structure embodiment of a table and a table lookup method thereof according to the present invention. As shown in FIG. 5, an embodiment of a storage structure of the table shown in FIG. 4 is shown. The following takes the input values 001*********** and looio********** as an example to illustrate the process of looking up the table according to the present invention. When the input value is 001*************, the corresponding N is equal to 3; X is equal to 1; and S is equal to 3.
  • the index value in Figure 5 has no corresponding entry, and the return fails.
  • the index value of 23 corresponds to multiple entries, which are compared one by one. After comparison, there is no item corresponding to 10010****** in the table, and the search fails to return.
  • the method for constructing a table for a network processor disclosed in the present invention combines the matching length to determine the storage location of the entry when the table entry is configured. There are two methods for processing:
  • the first step is to configure the entry to determine the matching bit length of the entry to be configured, and the matching bit value to determine the storage location of the entry. There are two ways to do this:
  • Step 4 If the index value corresponds to a unique entry, and the match is consistent, the search is completed, otherwise the process proceeds to the fifth step.
  • Step 5 If the index value corresponds to multiple entries, the entries are matched one by one with the input, if the matching bit If it matches exactly, the search is completed, otherwise the search fails.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Description

网络处理器使用的建表和查表方法 技术领域 本发明涉及网络通讯领域, 尤其涉及网络处理器使用的建表和查表方 法。 背景技术 随着信息技术的发展, 数据业务量越来越高, 不同数据协议和数据类型 的处理也越来越复杂, 因而要求网络节点具备灵活处理数据业务的能力。 现 在的网络处理器可以按照需求定制业务处理流程, 相对于原有的业务芯片具 有实现灵活、便于升级和开发周期短的优点,在最近几年内得到了广泛应用。 网络处理器对数据的处理一般包括: 流分类、 限速、 流量管理和整形、 报文修改等几个步骤。 网络处理器在处理过程中, 需要从数据中获得信息, 在获得数据包中信息后, 查表, 根据查表结果, 判断对数据包进行何种处理。 通常, 在数据处理过程中, 根据业务复杂度的不同, 要查若千张表, 如果查 表消耗的时间较长, 就会影响网络处理器的处理效率, 造成其性能下降。 影 响查表效率的因素主要有两个方面: 一是表的设计即建表方法, 也就是以什 么形式来保存表项; 二是查表方法, 即用什么方法来匹配输入项与表中已存 在项。 目前的网络处理器使用的表设计和查表方法, 有以下几种:
( 1 )完全匹配搜索算法, 使用 hash函数对输入 Key进行计算, 到树表 查找直到找到叶子、 键值和相应的信息, 都包含在 Patricia树结构中, Hash 函数进行 key bit到 Hash key的 n->n转换。
(2)最长匹配算法, 一次比较一个 bit, 直到找到^"确匹配项, 需要比较 n 次来识别是否是最符合的匹配。 不管是最精确匹配还是最长前缀匹配, 数 表创建保证只有一个最好匹配。 (3)使用 Hash函数进行最长匹配查找, 对网络协议地址的第一部分进行 hash, 映射成一个 VPN号, 并和 IP地址剩余部分合起来作为输入 key。 然后 逐个进行比较。 (4)使用多级存储实现数表处理, 要被访问的树被分级放在内存中, 数 表的第一部分数据放在第一个级内存, 第二部分放在第二级内存,依次类推。 在查表时, 处理器通过保存在内存级中的一个或多个部分来决定保存在内存 等级和输入搜索项之间一个或多个匹配项。 处理器、 第一个内存等级和第二 内存等级在一个集成电路上实现, 第三内存等级在这个集成电路外部实现。 如上所述, 在现有技术中, 有的查表通过逐个 bit比较, 有的使用 hash 算法计算 key值进行, 或者使用上述两种方法的结合, 或者分级建表分级查 表。 逐个 bit进行比较的方法, 在匹配的 bit位数较大时, 需要比较的次数较 多, 而利用 hash算法进行匹配的方法,可能产生冲突,也容易造成性能下降。 如果把比较的对象的 bit位数作为一个值参与匹配, 或者作为一个值参 与 hash计算, 或者使匹配在同一 bit长度的表项间进行, 则可以在变长表中 减少比较次数, 解决现有技术中存在的问题。 这里所说的匹配长度是指,树表表项的匹配字节长度或输入要匹配的字 段长度, t匕 ^口一个最长 16bit ό 表 ό 表项: 0101001110****** , 其匹 己长度 为 1 Obit, 6bit为通配, 如果一个输入的字段是: 10101010******** , 要匹配 字段是 10101010, 其匹配长度为 8bit。 发明内容 本发明的目的在于克服现有技术的不足之处,公开一种网络处理器使用 的建表和查表方法, 简化网络处理器的查表过程, 提高网络处理器的处理能 力, 对于匹配字节长度不固定的表, 效果尤其显著。 本发明公开的一种网络处理器使用的建表方法, 用于配置表项, 居上 述表项的匹配比特长度和匹配比特值计算存放索引值, 再才艮据上述存放索引 值确定上述表项的存储区域。 本发明公开的网络处理器使用的建表方法, 还包括如下从属技术特征: 上述计算存放索引值的方法是使用部分映射算法,或者使用完全映射算 法; 或者使用 Hash函数计算; 上述根据存放索引值确定表项的存储区域包括:根据上述表项的匹配比 特长度确定存放的区域, 具有相同匹配比特长度的表项根据匹配比特值确定 在相同区域中存放的位置; 设 N为上述表项的存放索引值, 上述计算存放索引值的公式是:
N = X/M + (S-1) 其中 X为上述表项的匹配比特值, M为模, S为上述表项的匹配比特 长度。 模 M的取值为 1024。 本发明还公开了一种网络处理器使用的查表方法, 用于匹配表项, 根据 输入字段的匹配比特长度和匹配比特值计算对应表项的索引值, 再根据上述 对应表项的索引值在上述表的存储区域查找具有相同索引值的表项, 上述输 入字段与上述具有相同索引值的表项逐个进行匹配, 如果存在完全匹配的上 述表项, 则返回查找完成, 否则返回查找失败。 本发明公开的网络处理器使用的查表方法, 还包括如下从属技术特征: 上述计算对应表项的索引值的方法是使用部分映射算法,或者使用完全 映射算法; 或者使用 Hash函数计算; 上述对应表项的索引值为输入字段的匹配比特长度和匹配比特值; 上述查找具有相同索引值的表项包括:根据上述输入字段的匹配比特长 度确定上述表项的存放的区域, 在相同匹配比特长度的表项中再才艮据上述输 入字段的匹配比特值确定在相同区域中存放的位置; 设 N为上述对应表项的索引值, 上述计算对应表项的索引值的公式是:
N = X/M + (S-1) 其中 X为上述表项的匹配比特值, M为模, S为上述表项的匹配比特 长度。 模 M的取值为 1024。 本发明公开的网络处理器使用的建表和查表方法, 把表项的 bit位数作 为一个值参与匹配, 或者作为一个值参与 hash计算, 或者使匹配在同一 bit 长度的表项间进行, 在变长表中减少比较次数, 优化了网络处理器的表的结 构, 实现网络处理器表的存储和高效查找, 简化查表过程, 提高网络处理器 的处理能力。 附图说明 此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部 分, 本发明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的 不当限定。 在附图中: 图 1 是根据本发明实施例的用于网络处理器的建表方法和查表方法流 程图。 图 2是根据本发明实施例的网络处理器表的存储结构示意图。 图 3是根据本发明的一种表的存储结构实施例及其查表方法示意图。 图 4是根据本发明实施例的网络处理器表的另一种存储结构示意图。 图 5是根据本发明的一种表的存储结构实施例及其查表方法示意图。 具体实施方式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在 不冲突的情况下, 本申请中的实施例及实施例中的特征可以相互组合。 图 1 是根据本发明实施例的用于网络处理器的建表方法和查表方法流 程图。 如图 1所示, 根据本发明实施例的网络处理器使用的建表方法和查表 方法主要包括: 首先建表, 包括配置表项, 即根据匹配比特的长度和匹配比特的值存储 表项。 在收到查表需求指令时,根据输入匹配数据计算对应的表项索引值。 计 算索引值可以釆用完全映射算法, 也可以使用部分映射算法, 如 Hash算法。
根据所述表项索引值, 判断表中是否存在对应的表项, 当表中没有对应 的表项时返回查表失败的标志结束本次查表, 等待新的查表需求。 如果表中存在对应的表项则进一步判断对应的表项是否唯一,如果对应 的表项是唯一的, 则进一步进行逐个比特比较, 并判断匹配是否成功, 匹配 成功则返回查表成功的标志结束本次查表, 等待新的查表需求; 匹配不成功 则返回查表失败的标志结束本次查表, 等待新的查表需求。 如果对应的表项不唯一,则将输入匹配数据与冲突项逐一进行逐个比特 的比较, 如果匹配不成功则返回查表失败的标志结束本次查表, 等待新的查 表需求; 如果匹配成功则返回查表成功的标志结束本次查表, 等待新的查表 需求。 图 2 是根据本发明实施例的网络处理器表的存储结构示意图。 如图 2 所示, 不同匹配长度的表项被分区域存放, 图中所示最大匹配长度为 16bit 的表, 不同的匹配长度的表项放在不同区域, 图中显示了 4bit、 8bit和 3bit 匹 区 i或。 图 2中的 Key用于表示一个索引值, keyl、 key2用于区别不同索引。 对于匹配长度小于 8 的表项, 以匹配比特值作为区域索引值对应存放, key 值减 1与区 i或 index值对应, Index值就是索引值。比如 4bit匹配区 i或中, 0000、 0001、 0010和 0100存放位置与 0、 1、 2和 4对应。 匹 己长度为 8或者大于 8, 按照表项的匹配比特值除以 128进行 hash映射, 在 8bit区域中, index5 对应有两个表项, 属于冲突项。 所谓表项的匹配比特值就是匹配长度的 bit 位对应的数值, 比 ¾。, 011**的匹配值是 011 , 对应十进制值为 3。 图 3是根据本发明的一种表的存储结构实施例及其查表方法示意图。如 图 3所示, 图中所示的表的存储结构是图 2所示的表的存储结构的实施例。 下面以两个输入值分另' J为 00000001********和 00000101********为例, 说 明本发明的查表过程: 1. 根据输入匹配长度确定在表的 8bit区域进行查找。
2. 按照映射算法, 确定两个输入的 hash值分别是 1和 5。 这里使用的 映射算法是按照表项的匹配比特值除以 128进行 hash映射。
3. 1对应有表项, 且与输入匹配, 查表成功返回。
4. 5有两个表项, 逐个表项比较, 查找成功返回。 图 4是根据本发明实施例的网络处理器表的另一种存储结构示意图。如 图 4所示, 才艮据匹配长度和匹配值计算索引来存放表项。 图中所示是最大匹 配长度为 16bit 的表, 才艮据匹配长度和匹配值顺序存放表项, 同样匹配长度 的表项集中存放, 具有同样匹配长度的表项再根据匹配值的大小按照顺序存 放。 同样,在查表时根据匹配长度和匹配值的计算值来判断表项存放的位置。 在本实施例中, 按照以下 hash函数计算表项存放位置: N = X/M + (S-1) 其中 N为表项存放位置, X为表项匹配值, M为模, 这里取 M = 1024, S为匹配长度。 由此函数算出的表项如图 5所示, 其中 index23对应有三个 表项, 属于冲突表项。 图 5是根据本发明的一种表的存储结构实施例及其查表方法示意图。如 图 5所示, 图中所示是如图 4所示的表的存储结构的实施例。 下面以输入值 001 *************和 looio**********为例, 说明按照本发明查表的过程。 当输入值是 001*************时, 对应的 N等于 3 ; X等于 1 ; 和 S 等于 3。
1. 根据输入匹配长度和匹配值,分别计算输入字段的 index值。经计算, 两个输入值对应的 index值分别是 3和 23。
2.才艮据 index值查表, 图 5中 index值为 3没有对应表项, 返回失败。
3. 图 5中 index值为 23对应有多个表项, 逐个进行比较。 经比较, 表 中没有与 10010**********对应的项, 查找失败返回。 本发明公开的用于网络处理器的建表方法在配置表项时结合匹配长度 来决定表项的存放位置, 有两种方法处理:
( 1 ) 以表项的匹配比特长度和匹配比特作为键值 ( Key ), 计算出该表 项的索引值, 使用该索引值在表中的相应位置保存该表项, 使用 hash函数计 算。
( 2 ) 将同样匹配长度的表项放在同一区域, 同一区域的表项索引通过 某一算法计算得到, 可以使用 hash函数。 在查表时, 居输入字段的匹配长度,与配置表项对应有两种方法查找:
( 1 )根据查表输入的匹配长度和匹配比特, 使用与配置表项相同的算 法计算索引值, 根据索引值查询表项。
( 2 ) 先根据要查表的匹配长度, 确定该表项在表中对应的区域, 然后 才艮据匹配比特值, 计算索引值查找。 下面再进一步具体描述本发明的用于网络处理器的建表和查表方法: 第一步 配置表项,才艮据要配置表项的匹配比特长度,以及匹配比特值确定表项 的存放位置, 具体有两种方法:
( 1 ) 把不同匹配长度的表项放在表中不同区域, 先根据匹配比特长度 确定表项存放的区域, 然后才艮据匹配比特值计算表项在该区域中存放位置, 可以使用 Hash函数计算。
( 2 ) 直接利用索引值存放, 根据匹配比特长度和匹配比特值, 计算存 放索引值, 在得到表项索引值后, 在表中存储该表项。 计算可以使用 Hash 函数 第二步 根据输入字段对表进行查询时,根据输入匹配长度, 与表配置对应有两 种查询方法: ( 1 )根据查表输入的匹配长度值, 确定该输入在表中对应的区域, 然 后, 才艮据匹配比特值, 计算在区域中的对应位置。
( 2 )根据查表输入的匹配长度值和匹配比特值, 利用与表项存放同一 的计算方法, 计算一个索引值; 第三步 用第二步中索引值到表中进行查找, 如果表对应的索引值没有表项, 则 查找失败; 否则第四步。 第四步 如果索引值对应唯一表项, 且匹配一致, 查找完成, 否则转向第五步; 第五步 如果索引值对应多个表项, 这几个表项与输入逐个进行匹配, 如果匹配 比特完全匹配, 则查找完成, 否则查找失败。

Claims

权 利 要 求 书
1. 一种网络处理器使用的建表方法, 用于配置表项, 其特征在于, 根据 所述表项的匹配比特长度和匹配比特值计算存放索引值, 再才艮据所述 存放索引值确定所述表项的存储区域。
2. 根据权利要求 1所述的建表方法, 其特征在于, 所述计算存放索引值 的方法是使用部分映射算法, 或者使用完全映射算法; 或者使用 Hash 函数计算。
3. 居权利要求 1所述的建表方法, 其特征在于, 所述 居所述存放索 引值确定所述表项的存储区域包括: 根据所述表项的匹配比特长度确 定存放的区域, 具有相同匹配比特长度的表项根据匹配比特值确定在 相同区域中存放的位置。
4. 根据权利要求 2所述的建表方法, 其特征在于, 设 N为所述表项的存 放索引值, 所述计算存放索引值的公式是:
N = X/M + (S-1)
其中 X为所述表项的匹配比特值, M为模, S为所述表项的匹配 比特长度。
5. 根据权利要求 4所述的建表方法,其特征在于,所述 M的取值为 1024。
6. —种网络处理器使用的查表方法, 用于匹配表项, 其特征在于, -据 输入字段的匹配比特长度和匹配比特值计算对应表项的索引值, 再根 据所述对应表项的索引值在所述表的存储区域查找具有相同索引值的 表项, 所述输入字段与所述具有相同索引值的表项逐个进行匹配, 如 果存在完全匹配的所述表项, 则返回查找完成, 否则返回查找失败。
7. 根据权利要求 6所述的查表方法, 其特征在于, 所述计算对应表项的 索引值的方法是使用部分映射算法, 或者使用完全映射算法; 或者使 用 Hash函数计算。
8. 根据权利要求 6所述的查表方法, 其特征在于, 所述对应表项的索引 值为输入字段的匹配比特长度和匹配比特值; 所述查找具有相同索引 值的表项包括: 居所述输入字段的匹配比特长度确定所述表项的存 放的区域, 在相同匹配比特长度的表项中再根据所述输入字段的匹配 比特值确定在相同区域中存放的位置。
9. 居权利要求 7所述的查表方法, 其特征在于, 设 N为所述对应表项 的索引值, 所述计算对应表项的索引值的公式是:
N = X/M + (S-1)
其中 X为所述表项的匹配比特值, M为模, S为所述表项的匹配 比特长度。
10. 根据权利要求 9所述的查表方法,其特征在于,所述 M的取值为 1024。
PCT/CN2009/074855 2009-05-04 2009-11-06 网络处理器使用的建表和查表方法 WO2010127536A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP09844288.2A EP2429132B1 (en) 2009-05-04 2009-11-06 Table creating and searching method used by network processor
US13/318,602 US20120054198A1 (en) 2009-05-04 2009-11-06 Table creating and lookup method used by network processor

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2009101069535A CN101556610B (zh) 2009-05-04 2009-05-04 网络处理器使用的建表和查表方法
CN200910106953.5 2009-05-04

Publications (1)

Publication Number Publication Date
WO2010127536A1 true WO2010127536A1 (zh) 2010-11-11

Family

ID=41174727

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2009/074855 WO2010127536A1 (zh) 2009-05-04 2009-11-06 网络处理器使用的建表和查表方法

Country Status (4)

Country Link
US (1) US20120054198A1 (zh)
EP (1) EP2429132B1 (zh)
CN (1) CN101556610B (zh)
WO (1) WO2010127536A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103294714B (zh) * 2012-02-28 2016-04-27 阿里巴巴集团控股有限公司 索引字段的字段属性值的存储位置的确定方法以及装置
CN103580893A (zh) * 2012-07-31 2014-02-12 中兴通讯股份有限公司 基于分组传送网设备的网络处理器配置写入方法及装置
CN102882810B (zh) * 2012-10-26 2016-02-10 杭州迪普科技有限公司 一种报文快速转发方法及装置
CN103905311B (zh) * 2012-12-28 2017-02-22 华为技术有限公司 流表匹配方法和装置以及交换机
US9378535B2 (en) * 2013-08-29 2016-06-28 Advanced Micro Devices, Inc. Efficient duplicate elimination
CN104092613A (zh) * 2014-07-15 2014-10-08 山东超越数控电子有限公司 一种基于模糊匹配的快速查表方法
CN108647289B (zh) * 2018-05-05 2022-01-21 中国人民解放军战略支援部队信息工程大学 基于布谷哈希和布隆过滤器的Hash建表方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1691523A (zh) * 2004-04-30 2005-11-02 明基电通股份有限公司 交插数据帧的方法及其电路
CN101021814A (zh) * 2007-03-16 2007-08-22 华为技术有限公司 存储、查询方法及存储控制器和查询系统
CN101350788A (zh) * 2008-08-25 2009-01-21 中兴通讯股份有限公司 一种网络处理器内外混合查表方法

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6061679A (en) * 1997-11-25 2000-05-09 International Business Machines Corporation Creating and searching a data structure ordered by ranges of key masks associated with the data structure
US6052683A (en) * 1998-02-24 2000-04-18 Nortel Networks Corporation Address lookup in packet data communication networks
ATE344562T1 (de) * 1999-11-18 2006-11-15 Broadcom Corp Tabellen-nachschlage-mechanismus zur adressauflösung in einer paket- netzwerkvermittlung
US6775414B1 (en) * 1999-11-19 2004-08-10 Ati International Srl Variable-length code decoder
US6490592B1 (en) * 1999-12-30 2002-12-03 Nortel Networks Limited Method of and apparatus for generating a tree data structure supporting longest match lookup
US6675163B1 (en) * 2000-04-06 2004-01-06 International Business Machines Corporation Full match (FM) search algorithm implementation for a network processor
EP1567928A4 (en) * 2002-09-03 2008-04-30 X1 Technologies Llc DEVICES AND METHOD FOR FINDING DATA
US7433355B2 (en) * 2004-02-09 2008-10-07 Alcatel Lucent Filter based longest prefix match algorithm
CN100418331C (zh) * 2006-03-03 2008-09-10 清华大学 基于网络处理器的路由查找结果缓存方法
TWI314820B (en) * 2006-05-26 2009-09-11 Ind Tech Res Inst Pattern-search based method for context-adaptive variable length coding/decoding
US7630367B2 (en) * 2006-09-01 2009-12-08 Wipro Limited Approach for fast IP address lookups
KR100745693B1 (ko) * 2006-09-29 2007-08-03 한국전자통신연구원 Tcam 테이블 관리 방법

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1691523A (zh) * 2004-04-30 2005-11-02 明基电通股份有限公司 交插数据帧的方法及其电路
CN101021814A (zh) * 2007-03-16 2007-08-22 华为技术有限公司 存储、查询方法及存储控制器和查询系统
CN101350788A (zh) * 2008-08-25 2009-01-21 中兴通讯股份有限公司 一种网络处理器内外混合查表方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2429132A4 *

Also Published As

Publication number Publication date
EP2429132A4 (en) 2014-08-06
CN101556610B (zh) 2011-12-21
CN101556610A (zh) 2009-10-14
EP2429132B1 (en) 2019-07-17
US20120054198A1 (en) 2012-03-01
EP2429132A1 (en) 2012-03-14

Similar Documents

Publication Publication Date Title
WO2010127536A1 (zh) 网络处理器使用的建表和查表方法
US7443841B2 (en) Longest prefix matching (LPM) using a fixed comparison hash table
TWI287723B (en) Method and data structure for a low memory overhead database
CN111953507B (zh) 一种网络拓扑发现方法、装置以及计算机存储介质
US20060083247A1 (en) Prefix lookup using address-directed hash tables
US20020147721A1 (en) Compact data structures for pipelined message forwarding lookups
CN108769111A (zh) 一种服务器连接方法、计算机可读存储介质及终端设备
CN102223289B (zh) 一种存储IPv4地址和IPv6地址的方法和装置
WO2011127642A1 (zh) 路由表建立方法和装置及路由表查找方法和装置
WO2013078644A1 (zh) 路由前缀存储方法、装置及路由地址查找方法、装置
CN105072030A (zh) 一种基于内容聚类的命名数据网络路由系统及其聚类查询方法
US20020143787A1 (en) Fast classless inter-domain routing (CIDR) lookups
WO2009070994A1 (fr) Procédé et dispositif d'appariement de règle de messagerie
WO2020207248A1 (zh) 一种流分类方法及装置
WO2006131045A1 (fr) Procédé de stockage et de recherche de nom de domaine de numéros e.164
WO2011124030A1 (zh) 路由表项的存储方法和装置
CN111277612B (zh) 一种网络报文处理策略生成方法、系统及介质
WO2021104393A1 (zh) 多规则流分类的实现方法、设备和存储介质
WO2008028412A1 (fr) Procédé et appareil de routage, et procédé d'enregistrement d'informations de routage
CN114884877B (zh) 一种哈希表和HOT相结合的IPv6路由查找方法
CN113315705A (zh) 基于单次哈希布隆过滤器的Flexible IP寻址方法及装置
WO2008119282A1 (fr) Procédé permettant d'acheminer une consultation et système de réacheminement
US20070025346A1 (en) System and method for creating a routing table
CN112235197A (zh) 一种并行路由查找方法及系统
CN102984071A (zh) 分段地址路由的路由表组织方法及查找路由的方法

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: 09844288

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 13318602

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 8878/CHENP/2011

Country of ref document: IN

WWE Wipo information: entry into national phase

Ref document number: 2009844288

Country of ref document: EP