WO2014201902A1 - 基于tcam的查表处理方法及装置 - Google Patents

基于tcam的查表处理方法及装置 Download PDF

Info

Publication number
WO2014201902A1
WO2014201902A1 PCT/CN2014/075855 CN2014075855W WO2014201902A1 WO 2014201902 A1 WO2014201902 A1 WO 2014201902A1 CN 2014075855 W CN2014075855 W CN 2014075855W WO 2014201902 A1 WO2014201902 A1 WO 2014201902A1
Authority
WO
WIPO (PCT)
Prior art keywords
query
tcam
query process
result
register
Prior art date
Application number
PCT/CN2014/075855
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 EP14814274.8A priority Critical patent/EP3012747B1/en
Priority to US14/898,332 priority patent/US20160132559A1/en
Publication of WO2014201902A1 publication Critical patent/WO2014201902A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • 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/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques
    • 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/74591Address table lookup; Address filtering using content-addressable memories [CAM]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • G06F16/24561Intermediate data storage techniques for performance improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24564Applying rules; Deductive queries
    • G06F16/24565Triggers; Constraints
    • 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/903Querying
    • G06F16/90335Query processing
    • G06F16/90339Query processing by using parallel associative memories or content-addressable memories

Definitions

  • the present invention relates to the field of communications, and in particular, to a TCAM-based table lookup processing method and apparatus.
  • a table lookup method based on a Ternary Content Addressable Memory (TCAM) is convenient and fast, and supports a table type of a long key value and a mask.
  • TCAM Ternary Content Addressable Memory
  • ACLs Access Control Lists
  • the equipment vendors of the general switch will choose TCAM to implement ACL or route lookup.
  • the look-up table architecture of the TCAM chip is determined.
  • the result returned by the TCAM look-up table can only be the entry index number, and the final result cannot be obtained.
  • TCAM lookup tables which first send control words and key values to the TCAM, then wait for the TCAM to check the table and return the result (result). Finally, use the index (index) in the returned result to check the direct table and get the desired result.
  • the TCAM look-up table in the related art includes the following steps: Step S102: Prepare a table look-up key value of the TCAM, and perform step S104 after preparation; Step S104: Check the TCAM table by using the prepared table key value.
  • step S106 determining whether the TCAM table has returned a result (result), if it has returned, executing step S108; if not, proceeding to step S106, that is, a waiting process; step S108: using The index in the returned result is checked to the direct table; Step S110: The desired result of the lookup table is obtained, and the process ends.
  • the time spent in step S106 is the time of a TCAM lookup table. During this time, because the register stored in the switch table is fixed, it is no longer possible to check other The entry can only be left blank. Therefore, the TCAM lookup table consumes a large amount of lookup performance.
  • TCAM As a service for table entry storage, although TCAM lookup table is simple and fast, forwarding performance is a big difficulty.
  • an effective solution has not yet been proposed.
  • the TCAM-based table lookup processing and device are provided by the TCAM-based table lookup processing method, and the TCAM-based table lookup processing and device are provided. To at least solve the above problem.
  • a TCAM-based lookup table processing method including: performing a first query process for querying a TCAM entry; performing the first query process, performing a query for a second query process of the other entries except the TCAM entry, wherein the first query process and the second query process are independently operated; by the first query process and the second query The process separately obtains the first query result and the second query result.
  • the obtaining, by the first query process, the first query result comprises: storing the first query result that is queried from the TCAM to a specified register other than the look-up table engine special register; and the first query result is The designated register is read to the look-up table engine special register; and the first query result is obtained from the query engine special register.
  • the method before reading the first query result from the specified register to the table lookup engine special register, the method includes: determining whether the second query process ends, wherein, in the case of determining to end, The first query result is read from the specified register to the lookup table engine special register.
  • determining whether the second query process ends the method includes: determining whether the to-be-queried entry in the other entry has traversed the query completion.
  • the obtaining, by the second query process, the second query result comprises: storing the second query result found by the second query process to the table lookup engine special register; The second query result is obtained in a query engine special register.
  • performing a second query process for querying other entries except the TCAM entry includes: executing the first query process after triggering execution of the first query process according to the query message for querying the TCAM entry
  • the second query process is described.
  • a TCAM-based lookup table processing apparatus including: a first execution module, configured to execute a first query process for querying a TCAM entry; and a second execution module, set to During the execution of the first query, a second query process for querying other entries than the TCAM entry is performed, where the first query process and the second query process are independently run.
  • the obtaining module is configured to obtain the first query result and the second query result respectively by using the first query process and the second query process.
  • the obtaining module includes: a first storage unit configured to store a first query result queried from the TCAM to a designated register other than the table look-aware engine special register; and a reading unit configured to set the first A query result is read from the specified register to the look-up table engine special register; and the first obtaining unit is configured to obtain the first query result from the query engine special register.
  • the obtaining module includes: a second storage unit, configured to store the second query result found by the second query process to the table lookup engine special register; and the second obtaining unit is set to Obtaining the second query result from the query engine special register.
  • the second execution module is configured to execute the second query process after triggering execution of the first query process according to the query message for querying the TCAM entry.
  • the method for performing the second query process for querying other entries except the TCAM entry in the first query process for querying the TCAM entry is used in the embodiment of the present invention to solve the related In the technology, the TCAM-based lookup mode results in a longer packet processing time, which in turn affects the technical performance of the packet forwarding performance, thereby reducing the packet processing time and improving the packet forwarding performance.
  • FIG. 1 is a flowchart of a TCAM lookup table method according to the related art
  • FIG. 2 is a flowchart of a TCAM-based table lookup processing method according to an embodiment of the present invention
  • 3 is a block diagram showing the structure of a TCAM-based lookup table processing device according to an embodiment of the present invention
  • FIG. 4 is a block diagram showing another structure of a TCAM-based table lookup processing device according to an embodiment of the present invention
  • FIG. 6 is a flowchart of a TCAM based table lookup processing method in accordance with a preferred embodiment of the present invention.
  • DETAILED DESCRIPTION OF THE INVENTION The present invention will be described in detail below 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.
  • 2 is a flow chart of a TCAM-based lookup table processing method according to an embodiment of the present invention. As shown in FIG.
  • the method includes: Step S202: Perform a first query process for querying a TCAM entry.
  • the specific implementation process As follows: The first query result queried from the TCAM is stored to a specified register other than the look-up table engine special register; the first query result is read from the specified register to the look-up engine special register; and is obtained from the query engine special register The first query result.
  • the foregoing determining process may be performed in the following manner: determining whether the to-be-queried entry in the other entry has traversed the query completion.
  • the foregoing second query process may be implemented by: storing the second query result found by the second query process to the table lookup engine special register; and obtaining the second query result from the query engine special register.
  • the timing of executing the second query process for querying other entries except the TCAM entry may be selected at any timing in the second query process, depending on the actual situation, in a preferred embodiment of the embodiment.
  • the second query process may be performed.
  • a TCAM-based table lookup processing device is further provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and has not been described again.
  • the modules involved in the device are described below. Be explained. As used hereinafter, the term "module" may implement a combination of software and/or hardware of a predetermined function.
  • FIG. 3 is a structural block diagram of a TCAM-based lookup table processing apparatus according to an embodiment of the present invention. As shown in FIG. 3, the apparatus includes: a first execution module 30, connected to the second execution module 32 and the acquisition module 34, configured to execute for querying
  • a first query process of the TCAM entry a second execution module 32, coupled to the obtaining module 34, configured to perform a second query process for querying other entries than the TCAM entry during the execution of the first query
  • the first query process and the second query process are independently executed.
  • the obtaining module 34 is configured to obtain the first query result and the second query result respectively by using the first query process and the second query process.
  • the functions implemented by the above modules can also fully utilize the waiting time for waiting for the query result in the first query process, thereby effectively reducing the packet processing time and improving the forwarding performance of the packet.
  • the foregoing obtaining module 34 includes: a first storage unit 340 connected to the reading unit 342, configured to store the first query result queried from the TCAM to the table-specific engine special register. a specific register; the reading unit 342 is connected to the first obtaining unit 344, configured to read the first query result from the specified register to the look-up table special register; the first obtaining unit 344 is set to be from the query engine special register Get the first query result.
  • the foregoing obtaining module 34 includes: a second storage unit 346 connected to the second obtaining unit 348, configured to store the second query result found by the second query process to the table look-ahead engine The second acquisition unit 348 is configured to obtain a second query result from the query engine special register.
  • the second execution module 32 is configured to perform the second query process after triggering execution of the first query process according to the query message for querying the TCAM entry.
  • Embodiment 1 This embodiment provides a TCAM-based lookup table processing method. In the process of waiting for a result in a TCAM lookup table, a lookup of other entries is added, thereby reducing packet processing time and improving packet forwarding. performance.
  • the technical solution adopted in this embodiment is as follows: Fully utilize the time in the related technology (the solution shown in FIG.
  • Step S502 Prepare a table lookup key value of the TCAM, and perform step S504 after preparation; Step S504: Check the TCAM table by using the prepared table lookup key value. It should be emphasized here that the TCAM lookup table is different from other common lookup tables.
  • the TCAM lookup table is a process in which the data processing chip sends control words and key values to the TCAM, and the TCAM performs the table lookup alone.
  • the data processing chip only needs to specify a return register for the TCAM lookup table (the return register does not occupy the look-up engine special register, and the look-up engine special register can read the TCAM return value in the return register), and then look up the table in the TCAM. During the waiting process, the data processing chip can then look up other entries. Then in step S504, the data processing chip must specify that the TCAM lookup table ends and the result returns to a return register instead of the lookup engine special register.
  • Step S506 See if there is an item that needs to be searched in parallel, that is, an item that is not related to the TCAM search result.
  • Step S508 Read TCAM return value register, read TCAM search result to look-up table engine special register
  • the above scheme in this embodiment is applicable to lookup tables for various types of TCAM.
  • Embodiment 2 This embodiment gives an example of a simple message processing. See Table 1, a total of four tables need to be checked: where table 1 is a separate entry, when it is not necessary to check; table2-table4 must be checked sequentially, table4 depends on table3, table3 depends on table2. Table 1
  • the TCAM-based table lookup processing method includes the following processing steps: Step S602: Preparing a table lookup key value (IP address + private network number) of the routing table, and performing step S604 after preparation is completed. Step S604: Check the TCAM table with the prepared table key value, and the TCAM table search result is returned to a return register. Step S606 is performed; Step S606: Interspersing the parallel search to find an independent spanning tree table.
  • step S608 After the spanning tree table search ends (that is, the search result is returned), step S608 is performed; step S608: reading the TCAM return value register, reading the TCAM lookup result into the table lookup engine special register; performing step S610; step S610: Determining whether the TCAM lookup table has returned a result (result), if it has returned, executing step S612; if not, proceeding to step S610, that is, a waiting process, even if waiting for a short time; step S612: using return The index in the result of the search for the route directly to the table, get the results of the table you really want.
  • Step S614 is performed; Step S614: The next hop index table is checked by using the next hop index number in the route direct table result; Step S616: End.
  • the embodiment of the present invention achieves the following beneficial effects: in the process of waiting for the result of the TCAM lookup table, the parallel search of other entries is added, which reduces the processing time of the packet, thereby improving the forwarding performance of the packet. .
  • software is also provided for performing the technical solutions described in the above embodiments and preferred embodiments.
  • a storage medium is provided, the software being stored, including but not limited to: an optical disk, a floppy disk, a hard disk, a rewritable memory, and the like.
  • modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the above are only the preferred embodiments of the present invention, and are not intended to limit the present invention, and various modifications and changes can be made to the present invention.
  • the utility of the present invention provides the above technical solution provided by the present invention, which can be applied to a table lookup process based on a TCAM of a three-state content-addressable memory, and is executed in a first query process for querying a TCAM entry.
  • the technical means for querying the second query process of the entry other than the TCAM entry solves the problem that the packet processing time caused by the TCAM-based lookup mode is longer, which affects the forwarding of the packet.
  • Technical problems such as performance, which reduces the processing time of packets, thereby improving the forwarding performance of packets.

Landscapes

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

Abstract

本发明提供了一种基于TCAM的查表处理方法及装置,其中,上述方法包括:执行用于查询TCAM表项的第一查询过程;在执行所述第一查询过程中,执行用于查询除所述TCAM表项之外的其它表项的第二查询过程,其中,所述第一查询过程和所述第二查询过程是独立运行的;通过所述第一查询过程和所述第二查询过程分别获取第一查询结果和第二查询结果。采用本发明提供的上述技术方案,解决了相关技术中,基于TCAM的查表方式导致的报文处理时间较长,进而影响到报文的转发性能等技术问题,进而减少了报文处理的时间,从而提高了报文的转发性能。

Description

基于 TCAM的査表处理方法及装置
技术领域 本发明涉及通信领域, 尤其是涉及一种基于 TCAM的查表处理方法及装置。 背景技术 基于三态内容寻址存储器 (Ternary Content Addressable Memory, 简称为 TCAM) 的查表方式, 方便快捷, 支持长键值和掩码的查表类型。 在需要支持大量访问控制列 表 (Access Control List, 简称为 ACL) 或者大量路由的时候, 一般交换机的设备商都 会选择 TCAM来实现 ACL或者路由的查表。 目前 TCAM芯片的查表架构是确定的, TCAM查表返回的结果只能是条目索引 号, 而不能得到最终的结果。 一个表项如果要通过 TCAM来实现, 需要设计成: 组装 好的键值去查 TCAM, TCAM返回条目索引号, 然后再使用这个条目索引号查一张直 接表,得到最终查表结果。也就是表项设计成 TCAM查表类型,就必须要查一张 TCAM 表和一张直接表。 开发者使用 TCAM查表,都是先将控制字和键值发送给 TCAM,然后等待 TCAM 查表结束将结果 (result) 返回。 最后再用返回的 result中的索引 (index) 查直接表, 得到想要的结果。 TCAM查表的过程中,因为芯片中查表结果存放的寄存器是唯一的, 因此不能再去查其他的表项, 只能空等待。 如图 1所示, 相关技术中的 TCAM查表方 案包括如下步骤: 步骤 S102: 准备 TCAM的查表键值, 准备完之后执行步骤 S104; 步骤 S104: 使用准备好的查表键值查 TCAM表, 然后执行步骤 S106; 步骤 S106: 判断 TCAM查表是否已经返回结果(result), 如果已经返回, 执行步 骤 S108; 如果没有返回, 继续执行步骤 S106, 也就是一个等待的过程; 步骤 S 108: 使用返回的 result中的 index查直接表; 步骤 S110: 得到想要的查表结果, 结束。 从上面的查表步骤中可以看到: 步骤 S106花费的时间就是一次 TCAM查表的时 间, 在这段时间内, 因为交换机中查表结果存放的寄存器是固定的, 因此不能再去查 其他的表项, 只能空等待。 因此, TCAM查表会消耗大量的查表性能, 在业务转发流程复杂的情况下, 会导 致业务达不到转发要求。 使用 TCAM作为表项存储的业务, 虽然 TCAM查表简单快 捷, 但是转发性能是一大难点。 针对相关技术中的上述问题, 目前尚未提出有效的解决方案。 发明内容 针对相关技术中, 基于 TCAM的查表方式导致的报文处理时间较长, 进而影响到 报文的转发性能等技术问题, 本发明实施例提供了一种基于 TCAM 的查表处理及装 置, 以至少解决上述问题。 根据本发明的一个实施例, 提供了一种基于 TCAM的查表处理方法, 包括: 执行 用于查询 TCAM表项的第一查询过程; 在执行所述第一查询过程中, 执行用于查询除 所述 TCAM表项之外的其它表项的第二查询过程, 其中, 所述第一查询过程和所述第 二查询过程是独立运行的; 通过所述第一查询过程和所述第二查询过程分别获取第一 查询结果和第二查询结果。 优选地, 通过所述第一查询过程获取第一查询结果, 包括: 将从 TCAM查询到的 第一查询结果存储至除查表引擎专用寄存器之外的指定寄存器; 将所述第一查询结果 从所述指定寄存器读取至所述查表引擎专用寄存器; 从所述查询引擎专用寄存器中获 取所述第一查询结果。 优选地, 将所述第一查询结果从所述指定寄存器读取至所述查表引擎专用寄存器 之前, 包括: 判断所述第二查询过程是否结束, 其中, 在判断为结束的情况下, 将所 述第一查询结果从所述指定寄存器读取至所述查表引擎专用寄存器。 优选地, 判断所述第二查询过程是否结束, 包括: 判断所述其它表项中的待查询 表项是否已经遍历查询完成。 优选地, 通过所述第二查询过程获取所述第二查询结果, 包括: 将通过所述第二 查询过程查找到的所述第二查询结果存储至所述查表引擎专用寄存器; 从所述查询引 擎专用寄存器中获取所述第二查询结果。 优选地,执行用于查询除所述 TCAM表项之外的其它表项的第二查询过程,包括: 在根据用于查询 TCAM表项的查询消息触发执行所述第一查询过程后,执行所述第二 查询过程。 根据本发明的另一个实施例, 提供了一种基于 TCAM的查表处理装置, 包括: 第 一执行模块, 设置为执行用于查询 TCAM表项的第一查询过程; 第二执行模块, 设置 为在执行所述第一查询过程中,执行用于查询除所述 TCAM表项之外的其它表项的第 二查询过程, 其中, 所述第一查询过程和所述第二查询过程是独立运行的; 获取模块, 设置为通过所述第一查询过程和所述第二查询过程分别获取第一查询结果和第二查询 结果。 优选地, 所述获取模块包括: 第一存储单元, 设置为将从 TCAM查询到的第一查 询结果存储至除查表引擎专用寄存器之外的指定寄存器; 读取单元, 设置为将所述第 一查询结果从所述指定寄存器读取至所述查表引擎专用寄存器; 第一获取单元, 设置 为从所述查询引擎专用寄存器中获取所述第一查询结果。 优选地, 所述获取模块包括: 第二存储单元, 设置为将通过所述第二查询过程查 找到的所述第二查询结果存储至所述查表引擎专用寄存器; 第二获取单元, 设置为从 所述查询引擎专用寄存器中获取所述第二查询结果。 优选地, 所述第二执行模块, 设置为在根据用于查询 TCAM表项的查询消息触发 执行所述第一查询过程后, 执行所述第二查询过程。 通过本发明实施例, 采用在执行用于查询 TCAM表项的第一查询过程中, 执行用 于查询除所述 TCAM表项之外的其它表项的第二查询过程的技术手段,解决了相关技 术中, 基于 TCAM的查表方式导致的报文处理时间较长, 进而影响到报文的转发性能 等技术问题, 进而减少了报文处理的时间, 从而提高了报文的转发性能。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中: 图 1为根据相关技术的 TCAM查表方法的流程图; 图 2为根据本发明实施例的基于 TCAM的查表处理方法的流程图; 图 3为根据本发明实施例的基于 TCAM的查表处理装置的结构框图; 图 4为根据本发明实施例的基于 TCAM的查表处理装置的另一结构框图; 图 5为根据本发明优选实施例的基于 TCAM的查表处理方法的流程图; 以及 图 6为根据本发明优选实施例的基于 TCAM的查表处理方法的流程图。 具体实 式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在不冲突的 情况下, 本申请中的实施例及实施例中的特征可以相互组合。 图 2为根据本发明实施例的基于 TCAM的查表处理方法的流程图。 如图 2所示, 该方法包括: 步骤 S202, 执行用于查询 TCAM表项的第一查询过程; 步骤 S204, 在执行第一查询过程中, 执行用于查询除 TCAM表项之外的其它表 项的第二查询过程, 其中, 第一查询过程和第二查询过程是独立运行的; 步骤 S206,通过第一查询过程和第二查询过程分别获取第一查询结果和第二查询 结果。 通过上述各个处理步骤, 由于在执行用于查询 TCAM表项的第一查询过程中, 执 行了用于查询除所述 TCAM表项之外的其它表项的第二查询过程,充分利用了上述第 一查询过程中用于等待查询结果的等待时间, 从而有效减少了报文处理的时间, 进而 提高了报文的转发性能。 本实施例中, 为了不影响正常 TCAM查表, 在通过第一查询过程获取第一查询结 果的过程中, 需要设置一个和查表引擎专用寄存器不同的指定寄存器存储返回的查询 结果, 具体实现过程如下: 将从 TCAM查询到的第一查询结果存储至除查表引擎专 用寄存器之外的指定寄存器; 将第一查询结果从指定寄存器读取至查表引擎专用寄存 器; 从查询引擎专用寄存器中获取第一查询结果。 在本实施例中, 将第一查询结果从指定寄存器读取至查表引擎专用寄存器之前, 需要判断第二查询过程是否结束, 其中, 在判断为结束的情况下, 将第一查询结果从 指定寄存器读取至查表引擎专用寄存器。 在上述其它表项为多个时, 上述判断过程可以表现为以下方式: 判断其它表项中 的待查询表项是否已经遍历查询完成。 上述第二查询过程可以通过以下方式实现: 将通过第二查询过程查找到的第二查 询结果存储至查表引擎专用寄存器; 从查询引擎专用寄存器中获取第二查询结果。 执行用于查询除 TCAM表项之外的其它表项的第二查询过程的时机可以选择在第 二查询过程中的任意时机, 具体根据实际情况而定, 在本实施例的一个优选实施方式 中, 可以在根据用于查询 TCAM表项的查询消息触发执行第一查询过程后, 执行第二 查询过程。 在本实施例中还提供了一种基于 TCAM的查表处理装置,该装置用于实现上述实 施例及优选实施方式, 已经进行过说明的不再赘述, 下面对该装置中涉及到的模块进 行说明。 如以下所使用的, 术语 "模块"可以实现预定功能的软件和 /或硬件的组合。 尽管以下实施例所描述的装置较佳地以软件来实现, 但是硬件, 或者软件和硬件的组 合的实现也是可能并被构想的。图 3为根据本发明实施例的基于 TCAM的查表处理装 置的结构框图。 如图 3所示, 该装置包括: 第一执行模块 30, 连接至第二执行模块 32和获取模块 34, 设置为执行用于查询
TCAM表项的第一查询过程; 第二执行模块 32, 连接至获取模块 34, 设置为在执行第一查询过程中, 执行用 于查询除 TCAM表项之外的其它表项的第二查询过程, 其中, 第一查询过程和第二查 询过程是独立运行的; 获取模块 34,设置为通过第一查询过程和第二查询过程分别获取第一查询结果和 第二查询结果。 通过上述各个模块实现的功能, 同样可以充分利用上述第一查询过程中用于等待 查询结果的等待时间, 从而有效减少报文处理的时间, 进而提高报文的转发性能。 优选地, 如图 4所示, 上述获取模块 34包括: 第一存储单元 340, 连接至读取单 元 342, 设置为将从 TCAM查询到的第一查询结果存储至除查表引擎专用寄存器之外 的指定寄存器; 读取单元 342, 连接至第一获取单元 344, 设置为将第一查询结果从 指定寄存器读取至查表引擎专用寄存器; 第一获取单元 344, 设置为从查询引擎专用 寄存器中获取第一查询结果。 优选地, 如图 4所示, 上述获取模块 34包括: 第二存储单元 346, 连接至第二获 取单元 348, 设置为将通过第二查询过程查找到的第二查询结果存储至查表引擎专用 寄存器; 第二获取单元 348, 设置为从查询引擎专用寄存器中获取第二查询结果。 优选地, 上述第二执行模块 32, 设置为在根据用于查询 TCAM表项的查询消息 触发执行第一查询过程后, 执行第二查询过程。 为了更好地理解上述实施例, 以下结合上述实施例的优选实施例 1 -2详细说明。 实施例 1 本实施例提供一种基于 TCAM的查表处理方法, 在 TCAM查表等待结果的过程 中, 加入了其他表项的查找, 从而减少了报文处理的时间, 提高了报文的转发性能。 为实现上述目的, 本实施例采用的技术方案如下: 充分利用相关技术中 (如图 1 所示的方案) 空等待的时间, 穿插查找其他的需要查找的表项 (如查一张哈希表), 查 找完成之后, 再判断 TCAM查表是否已完成, 如果完成, 再查一张直接表, 没有完成 则等待。 如图 5所示, 该方法包括以下处理步骤: 步骤 S502: 准备 TCAM的查表键值, 准备完之后执行步骤 S504; 步骤 S504: 使用准备好的查表键值查 TCAM表。 在此需要强调的是: TCAM查表和其他的普通查表不一样, TCAM查表是数据处 理芯片将控制字和键值发送给 TCAM, TCAM独自进行查表的过程。 数据处理芯片只需要给 TCAM 查表指定一个返回寄存器 (该返回寄存器不占用查 表引擎专用寄存器,而查表引擎专用寄存器又可以读取到返回寄存器中的 TCAM返回 值), 然后在 TCAM查表等待的过程中, 数据处理芯片就可以再去查找其他的表项。 于是在步骤 S504中, 数据处理芯片必须指定 TCAM查表结束, result返回到一 个返回寄存器, 而非查表引擎专用寄存器。
TCAM查表命令执行完成之后 (也就是将控制字和键值发送给 TCAM之后), 执行 步骤 3。 步骤 S506: 看有没有需要并行查找的表项, 也就是和 TCAM查找结果无关的表 项。如果有的话, 就穿插在 TCAM等待的间隙查找, 即并行查找, 并行查表结束之后, 执行步骤 S508; 步骤 S508: 读取 TCAM返回值寄存器, 将 TCAM查找 result读取到查表引擎专 用寄存器中; 执行步骤 S510; 步骤 S510: 判断 TCAM查表是否已经返回 result, 如果返回, 执行步骤 S512; 如果没有返回, 继续执行步骤 S510, 也就是一个等待的过程, 即使等待也是一个很短 的时间; 步骤 S512: 使用返回的 result中的 index查直接表, 得到真正想要的查表结果。 结束。 本实施例中的上述方案适用于对各种类型的 TCAM查表。 实施例 2 本实施例给出了一个简单的报文处理的实例。 见表 1, 一共需要查四张表: 其中 table 1 是一张独立的表项, 什么时候查都无所谓; table2-table4必须顺序查, table4 依赖 table3, table3依赖 table2。 表 1
Figure imgf000008_0001
如图 6所示, 本实施例提供的基于 TCAM的查表处理方法包括以下处理步骤: 步骤 S602: 准备路由表的查表键值 (IP地址 +专用私网号), 准备完之后执行步骤 S604; 步骤 S604: 使用准备好的查表键值查 TCAM表, TCAM查表结果返回到一个返 回寄存器。 执行步骤 S606; 步骤 S606: 穿插并行查找, 查找独立的生成树表。 生成树表查找结束 (也就是返 回了查找结果)之后, 执行步骤 S608; 步骤 S608: 读取 TCAM返回值寄存器, 将 TCAM查找 result读取到查表引擎专 用寄存器中; 执行步骤 S610; 步骤 S610: 判断 TCAM查表是否已经返回结果 (result), 如果已返回, 执行步 骤 S612; 如果没有返回, 继续执行步骤 S610, 也就是一个等待的过程, 即使等待也 是一个很短的时间; 步骤 S612: 使用返回的 result中的 index查路由直接表, 得到真正想要的查表结 果。 执行步骤 S614; 步骤 S614: 使用路由直接表结果中的下一跳索引号查下一跳索引表; 步骤 S616: 结束。 综上所述,本发明实施例实现了以下有益效果:在 TCAM查表等待结果的过程中, 加入了其它表项的并行查找, 减少了报文处理的时间, 从而提高了报文的转发性能。 在另外一个实施例中, 还提供了一种软件, 该软件用于执行上述实施例及优选实 施方式中描述的技术方案。 在另外一个实施例中, 还提供了一种存储介质, 该存储介质中存储有上述软件, 该存储介质包括但不限于: 光盘、 软盘、 硬盘、 可擦写存储器等。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 并且在某些情况下, 可以以不同于此处 的顺序执行所示出或描述的步骤, 或者将它们分别制作成各个集成电路模块, 或者将 它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明不限制于任 何特定的硬件和软件结合。 以上仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技术人 员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的任何 修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。 : r k实用性 采用本发明提供的上述技术方案,可以应用于基于三态内容寻址存储器 TCAM的 查表处理过程中, 采用在执行用于查询 TCAM表项的第一查询过程中, 执行用于查询 除所述 TCAM表项之外的其它表项的第二查询过程的技术手段, 解决了相关技术中, 基于 TCAM的查表方式导致的报文处理时间较长,进而影响到报文的转发性能等技术 问题, 进而减少了报文处理的时间, 从而提高了报文的转发性能。

Claims

权 利 要 求 书
1. 一种基于三态内容寻址存储器 TCAM的查表处理方法, 包括:
执行用于查询 TCAM表项的第一查询过程;
在执行所述第一查询过程中,执行用于查询除所述 TCAM表项之外的其它 表项的第二查询过程, 其中, 所述第一查询过程和所述第二查询过程是独立运 行的;
通过所述第一查询过程和所述第二查询过程分别获取第一查询结果和第二 查询结果。
2. 根据权利要求 1所述的方法,其中,通过所述第一查询过程获取第一查询结果, 包括:
将从 TCAM 查询到的第一查询结果存储至除查表引擎专用寄存器之外的 指定寄存器;
将所述第一查询结果从所述指定寄存器读取至所述查表引擎专用寄存器; 从所述查询引擎专用寄存器中获取所述第一查询结果。
3. 根据权利要求 2所述的方法, 其中, 将所述第一查询结果从所述指定寄存器读 取至所述查表引擎专用寄存器之前, 包括:
判断所述第二查询过程是否结束, 其中, 在判断为结束的情况下, 将所述 第一查询结果从所述指定寄存器读取至所述查表引擎专用寄存器。
4. 根据权利要求 3所述的方法, 其中, 判断所述第二查询过程是否结束, 包括: 判断所述其它表项中的待查询表项是否已经遍历查询完成。
5. 根据权利要求 1所述的方法, 其中, 通过所述第二查询过程获取所述第二查询 结果, 包括:
将通过所述第二查询过程查找到的所述第二查询结果存储至所述查表引擎 专用寄存器;
从所述查询引擎专用寄存器中获取所述第二查询结果。 根据权利要求 1至 5任一项所述的方法, 其中, 执行用于查询除所述 TCAM表 项之外的其它表项的第二查询过程, 包括:
在根据用于查询 TCAM表项的查询消息触发执行所述第一查询过程后,执 行所述第二查询过程。 一种基于三态内容寻址存储器 TCAM的查表处理装置, 包括:
第一执行模块, 设置为执行用于查询 TCAM表项的第一查询过程; 第二执行模块, 设置为在执行所述第一查询过程中, 执行用于查询除所述 TCAM表项之外的其它表项的第二查询过程, 其中, 所述第一查询过程和所述 第二查询过程是独立运行的;
获取模块, 设置为通过所述第一查询过程和所述第二查询过程分别获取第 一查询结果和第二查询结果。 根据权利要求 7所述的装置, 其中, 所述获取模块包括:
第一存储单元,设置为将从 TCAM查询到的第一查询结果存储至除查表引 擎专用寄存器之外的指定寄存器;
读取单元, 设置为将所述第一查询结果从所述指定寄存器读取至所述查表 引擎专用寄存器;
第一获取单元, 设置为从所述查询引擎专用寄存器中获取所述第一查询结 果。 根据权利要求 7所述的装置, 其中, 所述获取模块包括: 第二存储单元, 设置为将通过所述第二查询过程查找到的所述第二查询结 果存储至所述查表引擎专用寄存器;
第二获取单元, 设置为从所述查询引擎专用寄存器中获取所述第二查询结 果。 根据权利要求 7至 9任一项所述的装置, 其中, 所述第二执行模块, 设置为在 根据用于查询 TCAM表项的查询消息触发执行所述第一查询过程后,执行所述 第二查询过程。
PCT/CN2014/075855 2013-06-19 2014-04-21 基于tcam的查表处理方法及装置 WO2014201902A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP14814274.8A EP3012747B1 (en) 2013-06-19 2014-04-21 Tcam-based table query processing method and apparatus
US14/898,332 US20160132559A1 (en) 2013-06-19 2014-04-21 Tcam-based table query processing method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310244525.5 2013-06-19
CN201310244525.5A CN104239337B (zh) 2013-06-19 2013-06-19 基于tcam的查表处理方法及装置

Publications (1)

Publication Number Publication Date
WO2014201902A1 true WO2014201902A1 (zh) 2014-12-24

Family

ID=52103915

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/075855 WO2014201902A1 (zh) 2013-06-19 2014-04-21 基于tcam的查表处理方法及装置

Country Status (4)

Country Link
US (1) US20160132559A1 (zh)
EP (1) EP3012747B1 (zh)
CN (1) CN104239337B (zh)
WO (1) WO2014201902A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10003676B2 (en) * 2015-02-20 2018-06-19 Cavium, Inc. Method and apparatus for generating parallel lookup requests utilizing a super key
CN107517161B (zh) * 2016-06-15 2021-11-12 中兴通讯股份有限公司 一种网络处理器查表方法、网络处理器和查表系统
CN106301970A (zh) * 2016-10-27 2017-01-04 盛科网络(苏州)有限公司 一种使用转发表收敛以减少tcam表项消耗的芯片实现方法
CN106789706B (zh) * 2016-11-11 2020-08-07 天津光电通信技术有限公司 一种基于tcam的网络分流系统
CN107818151B (zh) * 2017-10-24 2020-12-11 湖南恒茂高科股份有限公司 数据查找方法、装置、计算机设备和存储介质
CN107896194B (zh) * 2018-01-02 2021-04-09 盛科网络(苏州)有限公司 一种路由查找方法、装置和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101035059A (zh) * 2006-03-08 2007-09-12 中兴通讯股份有限公司 一种提高三重内容可寻址存储器报文分类查找速度的方法
CN101834802A (zh) * 2010-05-26 2010-09-15 华为技术有限公司 转发数据包的方法及装置
CN102271087A (zh) * 2011-07-27 2011-12-07 中兴通讯股份有限公司 一种路由查找方法和装置
US20120137060A1 (en) * 2010-08-01 2012-05-31 Avidan Akerib Multi-stage TCAM search

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7408932B2 (en) * 2003-10-20 2008-08-05 Intel Corporation Method and apparatus for two-stage packet classification using most specific filter matching and transport level sharing
US7624313B2 (en) * 2005-03-28 2009-11-24 Hewlett-Packard Development Company, L.P. TCAM BIST with redundancy
US20080162429A1 (en) * 2006-12-29 2008-07-03 Ram T Reghu Search for an archived query
CN101986271B (zh) * 2010-10-29 2014-11-05 中兴通讯股份有限公司 调度tcam查询和刷新消息的方法和装置
US8861347B2 (en) * 2011-12-04 2014-10-14 Mellanox Technologies Ltd. Configurable access control lists using TCAM
CN102402611B (zh) * 2011-12-12 2013-07-24 盛科网络(苏州)有限公司 一种用tcam实现关键字快速查找并读表的方法
CN103117931B (zh) * 2013-02-21 2015-07-01 烽火通信科技股份有限公司 基于哈希表和tcam表的mac地址硬件学习方法及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101035059A (zh) * 2006-03-08 2007-09-12 中兴通讯股份有限公司 一种提高三重内容可寻址存储器报文分类查找速度的方法
CN101834802A (zh) * 2010-05-26 2010-09-15 华为技术有限公司 转发数据包的方法及装置
US20120137060A1 (en) * 2010-08-01 2012-05-31 Avidan Akerib Multi-stage TCAM search
CN102271087A (zh) * 2011-07-27 2011-12-07 中兴通讯股份有限公司 一种路由查找方法和装置

Non-Patent Citations (1)

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

Also Published As

Publication number Publication date
EP3012747B1 (en) 2017-10-18
US20160132559A1 (en) 2016-05-12
CN104239337B (zh) 2019-03-26
EP3012747A1 (en) 2016-04-27
EP3012747A4 (en) 2016-07-06
CN104239337A (zh) 2014-12-24

Similar Documents

Publication Publication Date Title
WO2014201902A1 (zh) 基于tcam的查表处理方法及装置
EP3035613B1 (en) Ccn routing using hardware-assisted hash tables
US9967187B2 (en) Exact match lookup with variable key sizes
US9467399B2 (en) Processing concurrency in a network device
US9269411B2 (en) Organizing data in a hybrid memory for search operations
US9569561B2 (en) Label masked addressable memory
US9871727B2 (en) Routing lookup method and device and method for constructing B-tree structure
US20060248095A1 (en) Efficient RAM lookups by means of compressed keys
WO2008119269A1 (fr) Procédé et dispositif de moteur de stockage et de consultation d'informations
WO2021135491A1 (zh) 流表的匹配方法及装置
AU2016230539B2 (en) Retrieval device, retrieval method, program, and recording medium
US8923298B2 (en) Optimized trie-based address lookup
US20080133494A1 (en) Method and apparatus for searching forwarding table
WO2021104393A1 (zh) 多规则流分类的实现方法、设备和存储介质
US20140358886A1 (en) Internal search engines architecture
US9485179B2 (en) Apparatus and method for scalable and flexible table search in a network switch
CN106487769B (zh) 一种访问控制列表acl的实现方法及装置
WO2016138845A1 (zh) 一种实现协议报文上送cpu的方法和装置
WO2015176315A1 (zh) 哈希连接方法、装置和数据库管理系统
WO2016091027A1 (zh) 一种网络地址转换与访问控制列表规则聚合方法和装置
US20200226099A1 (en) Method and apparatus for improving hash searching throughput in the event of hash collisions
US20170012874A1 (en) Software router and methods for looking up routing table and for updating routing entry of the software router
WO2020248690A1 (zh) 报文匹配查表方法、系统、存储介质和终端
WO2017215466A1 (zh) 一种网络处理器查表方法、网络处理器、查表系统及存储介质
JP6323887B2 (ja) ルートノードを変更するための方法および変更装置

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

Country of ref document: EP

Kind code of ref document: A1

REEP Request for entry into the european phase

Ref document number: 2014814274

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2014814274

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 14898332

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE