Method and apparatus for search engine caching

By combining a high-performance TCAM cache engine and a low-cost SRAM/DRAM engine in the search system, and using the maintenance controller's cache and aging table strategy, the search efficiency of TCAM devices is optimized, solving the high power consumption and cost of TCAM devices The problem of this achieves more efficient search result output.

CN110046286BActive Publication Date: 2024-12-13MARVELL ISRAEL (M L S L) LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN201910041143.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2018-01-16
Filing Date
2019-01-16
Publication Date
2024-12-13
Estimated Expiration
2039-01-16

AI Technical Summary

Technical Problem

Existing ternary content addressable memory (TCAM) devices are difficult to effectively optimize search efficiency due to high power consumption and high cost in search engines, especially in search operations that frequently match entries.

Method used

A search system architecture is designed, combining a high-finition speed ternary addressable memory (TCAM) cache engine with low-cost static random access memory (SRAM) or dynamic random access memory (DRAM) engine to control it through maintenance The machine selectively caches frequently matched entries into the TCAM cache engine based on hit statistics, and uses the aging table to optimize the replacement strategy of TCAM entries to avoid race conditions.

Benefits of technology

It improves the efficiency and speed of search operations, reduces power consumption and cost, and at the same time improves TCAM hit rate, achieving faster search result output.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110046286B_ABST
    Figure CN110046286B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method and apparatus for search engine caching. Aspects of the present disclosure provide a network device. The network device includes: a search engine, a ternary content addressable memory (TCAM) cache engine, a search key generation unit, and an output controller. The search engine stores a lookup table of entries for packet processing rules, and searches the lookup table in response to a packet received from a network interface of the network device. The TCAM cache engine caches a subset of entries in the lookup table based on hit statistics of the entries. The search key generation unit generates a search key based on the received packet, and provides the search key to the search engine and the TCAM cache engine. When the TCAM cache engine has a matching entry for the search key, the output controller outputs the search results from the TCAM cache engine.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Incorporated by Reference

[0002] This disclosure claims the benefit of U.S. Provisional Application No. 62 / 617,982, filed on January 16, 2018, “Search Engine-TCAM Engine System Optimization,” which is incorporated herein by reference in its entirety. Technical Field

[0003] The present invention generally relates to methods and apparatus for search engine caching. Background Art

[0004] The background description provided herein is for the purpose of generally presenting the context of the present disclosure. The work of the listed inventors (to the extent of the work described in this background section) and aspects of the specific embodiments that may not otherwise qualify as prior art at the time of filing are neither explicitly nor implicitly admitted as prior art for the present disclosure.

[0005] Typically, content addressable memory (CAM) is used in various applications to provide relatively fast search capabilities, where a search key is compared in parallel with multiple entry lines in the memory to find matching entries. In an example, a network device (such as a network switch, a router, etc.) includes a ternary CAM (TCAM) that stores multiple switching rules, and the switching rules are selected based on various attributes of the input packet and applied to the incoming packet. In some cases, the TCAM is established so that packets with different attributes can match the same TCAM entry so that the same switching rule is applied to packets with different attributes. Although TCAM devices are preferred according to some search operations, they are generally considered to be expensive resources, especially because relatively high power is required compared to other types of search engines. Summary of the invention

[0006] Aspects of the present disclosure provide a network device. The network device includes: a search engine, a ternary content addressable memory (TCAM) cache engine, a search key generation unit, and an output controller. The search engine stores a lookup table of entries for rules for packet processing, and searches the lookup table in response to a packet received from a network interface of the network device. The TCAM cache engine caches a subset of entries in the lookup table based on hit statistics of the entries. The search key generation unit generates a search key based on the received packet, and provides the search key to the search engine and the TCAM cache engine. The output controller outputs a first search result received from the TCAM cache engine and the search engine. The first received search result indicates a matching entry for the search key.

[0007] For example, the output controller is configured to output a first search result received from the TCAM cache engine without waiting for a second search result from the search engine.

[0008] According to aspects of the present disclosure, a network device includes a maintenance controller configured to selectively mirror a subset of entries from a search engine to a TCAM cache engine based on hit statistics. In some embodiments, when the TCAM cache engine does not have a matching entry for a search key, a second search result from the search engine is output. The maintenance controller is configured to selectively mirror a specific entry corresponding to the second search result from the search engine to the TCAM cache engine.

[0009] In some embodiments, the maintenance controller is configured to: maintain an aging table having bits corresponding to the subset of entries to track hit activity for the subset of entries in the TCAM cache engine. In some examples, the maintenance controller is configured to replace a subset of the subset of entries in the TCAM cache engine with a specific entry corresponding to the second search result based on the aging table.

[0010] In an example, the maintenance controller assigns two bits to a TCAM entry and sets one of the two bits to binary 1 when replacing the TCAM entry to inhibit the selected TCAM entry from being immediately replaced next time in order to avoid a race condition. In addition, the maintenance controller is configured to set a bit corresponding to a matching TCAM entry in the aging table to binary 1. The maintenance controller then periodically resets the bits in the aging table.

[0011] In an embodiment, the search engine comprises static random access memory (SRAM).In another embodiment, the search engine comprises dynamic random access memory (DRAM). BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Various embodiments of the present disclosure, which are presented as examples, will be described in detail with reference to the following drawings, in which like reference numerals refer to like elements, and in which:

[0013] Figure 1 A block diagram of an electronic device 100 according to an embodiment of the present disclosure is shown;

[0014] Figure 2 An example of caching entries from a search engine in an electronic device (such as electronic device 100) to a ternary content addressable memory (TCAM) cache engine according to an embodiment of the present disclosure is shown;

[0015] Figure 3 A flowchart describing a process 300 performed by an electronic device (eg, electronic device 100 ) according to an embodiment of the present disclosure is shown; and

[0016] Figure 4 A flow chart describing a process 400 performed by a maintenance controller in an electronic device (eg, electronic device 100 ) according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0017] The method of the present disclosure provides a search system architecture for an electronic device (such as a network device) that performs a search operation. The search system architecture is optimized to improve search efficiency. The search system architecture includes multiple search engines with different performance attributes, such as a first search engine with a high search speed and a second search engine with a low-cost memory, and the high-speed search engine is configured as a cache engine for other search engines. Specifically, in some embodiments, one of the search engines is a search engine based on a ternary addressable memory (TCAM), and is configured as a cache engine for other search engines that are low-cost and / or have lower performance. A search engine based on TCAM is called a TCAM cache engine, and a subset of entries stored in other search engines is cached based on hit statistics (e.g., search rate, number of searches, etc.) of the entries. For example, a subset of entries cached in a TCAM cache engine is searched more frequently than other entries in other search engines. Generally, compared with other search engines, a TCAM cache engine is regarded as a high-speed, high-performance and relatively expensive search engine. When entries that are searched more frequently are stored in a TCAM cache engine, the TCAM cache engine is used to perform search operations more frequently, and therefore more frequent search operations can be performed at a relatively high speed.

[0018] Figure 1 An electronic device 100 according to an embodiment of the present disclosure is shown, such as a network device, such as a server, a switch, a router, a storage adapter, or other suitable network device. The electronic device 100 includes a search system 130, which is configured to use a cache engine to improve search efficiency. Specifically, in Figure 1 In an example, the search system 130 includes a TCAM cache engine 140, and one or more search engines (such as a static random access memory (SRAM) search engine 150 that can be searched using a suitable hash algorithm). The TCAM cache engine 140 is configured to cache a subset of entries stored in one or more other search engines (such as the SRAM search engine 150). The subset of entries is selectively cached from the other search engines to the TCAM cache engine 140 based on hit statistics of the entries so that the TCAM cache engine 140 is filled with addresses that have a higher probability of being hit in a lookup operation.

[0019] Note that in some embodiments, other suitable search engines, such as a dynamic random access memory (DRAM) search engine (not shown), etc., may be used in place of the SRAM search engine 150 .

[0020] The electronic device 100 may be any suitable device that uses a search engine to match a search key to a stored data pattern (stored key), such as a network device. Figure 1 In the example, the electronic device 100 is a network device 100, such as a network switch, a router, etc. The network device 100 includes a packet processing engine 110, which is configured to process packets generated at the device, packets retrieved from a storage resource, or packets received through a network coupling. For example, the network device 100 receives input packets from other devices via an ingress port, and the packet processing engine 110 processes the packet and determines an action for the packet, such as forwarding the packet to one or more egress ports to output the packet, filtering the packet, collecting statistics for network management / security based on the attributes of the packet, etc.

[0021] According to aspects of the present disclosure, the packet processing engine 110 determines the action performed on the packet based on the rule. In an embodiment, the rule includes a criterion (stored as a key) and an action associated with the criterion (stored as an action code). The criterion specifies a data pattern for an attribute. In one example, some data patterns include range requirements and / or exact match requirements, in which several different packets can match the stored entries. In one example, the switching rule is expressed in simple English as "allow forwarding of packets with a source address of 172.15.5.0 / 24 and a TCP port number between 1 and 14". The switching rule includes a source address criterion, a protocol (TCP) criterion, a TCP port number criterion, and an action of "forwarding to port n" associated with the criterion. When the received packet meets the criterion, the action associated with the criterion can be taken for the received packet.

[0022] exist Figure 1 In the example, the packet processing engine 110 includes a processing circuit 120 and a search system 130 coupled together. In one embodiment, the processing circuit 120 includes a plurality of search clients, and the plurality of search clients request search services from the search system 130. In the example, the search clients are packet processing stages, and one or more packet processing stages are coupled together with the search system 130 to determine an action code for a packet.

[0023] In one example, the packet includes a 128-byte header. The packet processing stage parses a portion of the header separately. Then, the search system 130 searches for action codes separately based on the parsed portion of the header. The search results can be appropriately combined to determine the appropriate action code for the packet.

[0024] According to one aspect of the present disclosure, the criteria and associated actions are suitably stored in the search system 130, such as the SRAM search engine 150 and the TCAM cache engine 140. The search system 130 includes other suitable components, such as Figure 1 The search key generation unit 131, the output controller 160 coupled to the SRAM search engine 150 and the TCAM cache engine 140 are shown in FIG.

[0025] In an example, the search key generation unit 131 generates a search key based on the attributes of the packet. In an example, the search key is generated by parsing the packet header and extracting selected data from fields of the header and / or by incorporating other data associated with the packet, such as the port on which the packet was received. The search key is provided to both the TCAM cache engine 140 and the SRAM search engine 150 to perform a lookup operation.

[0026] In some embodiments, the TCAM cache engine 140 includes a TCAM block to store keys for criteria and a small portion of a conventional memory block (such as an SRAM block, a DRAM block, etc.) to store action codes for actions. In an embodiment, the key is stored in an entry of an index and the action code is stored at the address pointed to by the index of the entry.

[0027] In one example, the TCAM block includes a plurality of TCAM entries that are respectively used to store keys. The TCAM entry includes a plurality of TCAM cells, each of the plurality of TCAM cells being configured to store a ternary state, and thus each TCAM entry is capable of storing a range requirement expressed in a ternary form aligned with a binary form. For example, the value [16, 31] is represented in a binary aligned form as "01XXXX", where "X" represents a mask that matches both binary "0" and binary "1". Therefore, [16, 31] can be stored in a single entry of the TCAM cache engine 140. In another example, [32, 32] is an exact match requirement and can also be represented in a binary aligned form as "100000", so [32, 32] can be stored in a single entry of the TCAM cache engine 140. In another example, [16, 32] can be expanded to a combination of [16, 31] and [32, 32], which are represented as “01XXXX” and “100000” in binary alignment, so the TCAM cache engine 140 needs to use two entries to store [16, 32].

[0028] During a lookup operation, in the example, when a search key is provided to the TCAM cache engine 140, the search key is simultaneously compared with the TCAM entries in the TCAM cache engine 140 to find a matching entry (also referred to as a TCAM hit entry) that matches the search key. The address of the matching entry points to a memory space storing an action code, and the TCAM cache engine 140 outputs a search result (shown as an output signal 145), such as an action code, etc. Note that in the example, when the TCAM cache engine 140 fails to find a matching entry, the TCAM cache engine 140 outputs a code indicating a TCAM miss (in the output signal 145).

[0029] In some embodiments, the TCAM cache engine 140 stores a default entry that matches any search key, and the default entry points to a specific code. The default entry has the lowest priority. When the TCAM cache engine 140 has a matching entry other than the default entry, the action code associated with the matching entry is output, and when the TCAM cache engine 140 does not have other matching entries, the specific code associated with the default entry is output. Therefore, when the output signal 145 includes the specific code, the TCAM cache engine 140 has a TCAM miss.

[0030] In some embodiments, SRAM search engine 150 is configured to store rules in the form of a hash lookup table. For example, the entries of the lookup table storage rules based on hash. For example, each entry stores a compressed version of the key, the action code associated with the key, and other suitable information, such as a valid flag, a matching flag, etc. The entry is accessed by a hash operation to the key, for example, pointing to the address location where the entry is stored. In other words, the key is hashed to generate a hash code, and the hash code points to the memory space of the storage entry (such as a compressed key with an action code and other suitable information).

[0031] In some examples, the SRAM search engine 150 stores rules in an exact match format and is referred to as an exact match engine. For example, a range requirement is expanded into a combination of multiple exact match requirements, and multiple exact match requirements can be stored in multiple entries. For example. [16, 31] is stored in the SRAM search engine 150 using 16 entries, each entry storing a value in the range, and [32, 32] is stored in the SRAM search engine 140 using one storage entry.

[0032] During the search operation, in the example, when the search keyword is provided to the SRAM search engine 150, the search key is hashed to generate a hash code pointing to the memory space of the potential matching entry with the compression key and the action code. Then, the compression key is decompressed, and the decompressed key is compared with the search key. When the decompressed key matches the search key, the SRAM search engine 150 generates a search output (shown as an output signal 155), such as an action code in the potential matching entry.

[0033] According to one aspect of the present disclosure, the SRAM search engine 150 is configured to store a complete set of rules, and a subset of the rules stored in the SRAM search engine 150 is selectively cached (or mirrored) in the TCAM cache engine 140. Figure 1 In the example of , the search key generation unit 131 provides the search key to both the TCAM cache engine 140 and the SRAM search engine 150 to perform the search operation in both engines simultaneously. Generally, the TCAM cache engine 140 has a higher search speed than other search engines (such as the SRAM search engine 150). Therefore, when the TCAM cache engine 140 has a TCAM hit (e.g., meaning there is a matching entry for the search key other than the default entry), the TCAM cache engine 140 outputs an action code faster than the SRAM search engine 150.

[0034] According to one aspect of the present disclosure, the output controller 160 is configured to output the first search result received from the TCAM cache engine 140 and the SRAM search engine 150. In some embodiments, the TCAM cache engine 140 has a faster search speed than the SRAM search engine 150, and the output controller 160 is configured to prioritize the output signal 145 from the TCAM cache engine 140. For example, the output controller 160 is configured to operate based on the output signal 145. When the output signal 145 indicates a TCAM hit and includes an action code, the output controller 160 outputs the action code in the output signal 165 without waiting for the SRAM search engine 150 to generate the output signal 155. When the output signal 145 indicates a TCAM miss (e.g., the TCAM cache engine 140 does not have a matching entry for the search key other than the default entry), the output controller 160 waits for the SRAM search engine 150 to generate the output signal 155, and then outputs the output signal 165 based on the output signal 155. Thus, when TCAM cache engine 140 has a TCAM hit, search system 130 quickly generates output signal 165 .

[0035] According to one aspect of the present disclosure, the TCAM cache engine 140 is configured to cache rules that are used more frequently to improve the TCAM hit rate. In some embodiments, the rules stored in the SRAM search engine 150 are selectively cached in the TCAM cache engine 140 based on hit statistics of the rules.

[0036] exist Figure 1 In the example of , the packet processing engine 110 includes a maintenance controller 170, which is configured to collect hit statistics of the rules stored in the SRAM search engine 150, and selectively cache a subset of the rules to the TCAM cache engine 140 based on the hit statistics. The maintenance controller 170 can be implemented using various technologies. In one example, the maintenance controller 170 is implemented as an integrated circuit. In another example, the maintenance controller 170 is implemented as software instructions executed by a processor.

[0037] In some embodiments, the packet processing engine 110 includes multiple processors. Some of the processors can execute software instructions for packet processing and operate as a search client, and one of the processors can execute software instructions for maintenance and operate as a maintenance controller 170.

[0038] In one embodiment, the maintenance controller 170 is configured to cache rules from the SRAM search engine 150 to the TCAM cache engine 140 when the TCAM cache engine 140 has a TCAM miss. In one example, when the search key generation unit 131 provides a specific search key to the TCAM cache engine 140 and the SRAM search engine 150 for the first time, the TCAM cache engine 140 has a TCAM miss for the specific search key, and the output controller 160 waits for the SRAM search engine 150 to generate an output signal 155. The output signal 155 indicates a matching entry in the SRAM search engine 150 that matches the specific search key. For example, the output signal 155 includes an entry index of the matching entry in the SRAM search engine 150. The output controller 160 generates an output signal 165 based on the output signal 155, and also provides matching entry information (such as an entry index in the SRAM search engine 150) to the maintenance controller 170. Then, the maintenance controller 170 copies the rules in the matching entry from the SRAM search engine 150 to the TCAM cache engine 140.

[0039] Therefore, when the search key generation unit 131 provides the specific search key to the TCAM cache engine 140 and the SRAM search engine 150 for the second time, the TCAM cache engine 140 has a TCAM hit and generates an output signal 145 having an action code, and the output controller 160 generates an output signal 165 based on the output signal 145. Therefore, the search system 130 provides search results for the specific search key at a faster speed in the second time than in the first time.

[0040] In the application scenario, the electronic device 100 is a network switch in a network with a large amount of packet flow. A packet flow refers to a sequence of packets of the same packet type originating from the same packet source (e.g., an application in a first endpoint device) and sent to the same packet destination (e.g., an application in a second endpoint device).

[0041] When a new packet stream starts in the network, the electronic device 100 receives a sequence of packets in the packet stream and determines an action for the packet. In some embodiments, the search key generation unit 131 is configured to generate the same search key for packets in the same packet stream. Then, in response to the first packet in the packet stream, the search key generation unit 131 generates a search key for the packet stream for the first time, and provides the search key to the TCAM cache engine 140 and the SRAM search engine 150 for the first time. The TCAM cache engine 140 has a TCAM miss for the search key, and the output controller 160 waits for the SRAM search engine 150 to generate an output signal 155. The SRAM search engine 150 determines a matching entry for the search key and generates an output signal 155, which, in one example, includes an entry index of a matching entry in the SRAM search engine 150. The output controller 160 generates an output signal 165 based on the output signal 155, and also provides matching entry information (such as, an entry index in the SRAM search engine 150) to the maintenance controller 170. The maintenance controller 170 then copies the rules in the matching entry from the SRAM search engine 150 to the TCAM cache engine 140 .

[0042] Then, for the rest of the packet stream, the search key generation unit 131 generates the same search key in response to the rest of the packets in the packet stream, and provides the same search key to the TCAM cache engine 140 and the SRAM search engine 150. The TCAM cache engine 140 has a TCAM hit in response to the same search key and generates an output signal 145 having an action code, and the output controller 160 generates an output signal 165 based on the output signal 145. Therefore, the search system 130 provides search results for the rest of the packets in the packet stream at a faster speed than the first packet in the packet stream.

[0043] In addition, according to one aspect of the present disclosure, the TCAM cache engine 140 is configured to have a relatively small number of TCAM entries compared to the SRAM search engine 150 in order to save silicon space and reduce costs, and the maintenance controller 170 is configured to cache new entries into the TCAM cache engine 140 using aging-based entry replacement. In one example, the maintenance controller 170 is configured to maintain an aging table that tracks the hit activity of the TCAM entries. In some examples, the cached TCAM entries are associated with packet flows, so the hit activity of the TCAM entries indicates the activity of the packet flows associated with the TCAM entries. When a new flow starts, the maintenance controller 170 caches the key of the new flow into a TCAM entry with low hit activity or no hit activity.

[0044] Figure 2 An example of caching rules in an electronic device (eg, electronic device 100 ) from an SRAM search engine (eg, SRAM search engine 150 ) to a TCAM cache engine (eg, TCAM cache engine 140 ) according to an embodiment of the present disclosure is shown.

[0045] For example, the SRAM search engine 150 stores Figure 2 The lookup table 251 shown in FIG. The lookup table 251 includes a plurality of entries S0-S7, and each entry stores a key (or a compressed key), an action code associated with the key, and other suitable information. In addition, the TCAM cache engine 140 stores a subset of the keys in the TCAM entries T0-T2 in the TCAM block 241, and the TCAM entries T0-T2 point to a memory space in the SRAM block 242, and the SRAM block 242 stores the action code associated with the key, such as Figure 2 shown.

[0046] The maintenance controller 170 maintains an aging table 275 that tracks hit activity for TCAM entries T0-T2. In one example, the maintenance controller 170 is configured to periodically reset bits corresponding to the TCAM entries to binary 0. When a TCAM entry in the TCAM cache engine 140 is a TCAM hit entry for a search key, the TCAM cache engine 140 generates an output signal 145. In one example, the output signal 145 indicates an entry index of the TCAM hit entry. The output controller 160 provides the entry index of the TCAM hit entry to the maintenance controller 170, and the maintenance controller 170 sets the bit(s) corresponding to the TCAM entry in the aging table 275 to binary 1.

[0047] In addition, when caching entries (new entries) from the SRAM search engine 150 to the TCAM cache engine 140, the maintenance controller 170 selects a TCAM entry with low hit activity or no hit activity (e.g., having (multiple) aging bits that are 0) and replaces the TCAM entry with the new entry.

[0048] exist Figure 2 In the example of FIG. 1 , the maintenance controller 170 uses two bits to track the hit activity for the TCAM entries to avoid race conditions. For example, the two bits for each TCAM entry are periodically reset to 0. When the TCAM entry has a hit, both bits are set to 1. In one embodiment, when caching an entry (a new entry for the TCAM cache engine 140) from the SRAM search engine 150 to the TCAM cache engine 140, the maintenance controller 170 selects a TCAM entry with two aging bits of 0 to replace the new entry, and then sets one of the two aging bits to 1 to avoid race conditions.

[0049] Specifically, in Figure 2 In the example of , once (for example, when the first packet in the packet flow that needs to be processed according to entry S3 is received), the search key KEY3 is generated and provided to the SRAM search engine 150 and the TCAM cache engine 140. The TCAM cache engine 140 has a miss, and the entry S3 in the lookup table 251 matches the search key KEY3. The output controller 165 notifies the maintenance controller 170 of the TCAM miss, and also notifies the maintenance controller 170 of the index of the entry S3. The maintenance controller 170 checks the aging table 275 and finds that the TCAM entry T0 does not have a hit activity because both aging bits are 0. Therefore, the maintenance controller 170 selects the TCAM entry T0 for replacement, and then the maintenance controller 170 copies the entry S3 from the SRAM search engine 150 to the TCAM cache engine 140. For example, the TCAM entry T0 is replaced with KEY3, and the memory space pointed to by the TCAM entry T0 is replaced with the action code associated with KEY3. The maintenance controller 170 then updates one of the two aging bits corresponding to the TCAM entry T0 from binary 0 to binary 1.

[0050] Figure 3 A flow chart outlining a process 300 performed by an electronic device (eg, electronic device 100) according to one embodiment of the present disclosure is shown. The process starts at S301 and proceeds to S305.

[0051] At S305, a lookup table is stored in the SRAM search engine 140. In one example, the lookup table stores rules for forwarding packets in a packet stream. For example, a lookup entry for a rule for forwarding packets in a packet stream includes a key for identifying packets belonging to the packet stream and includes an action code for an action to be performed on the packets in the packet stream.

[0052] At S310, the electronic device 100 receives a packet. In one example, the packet is received from an ingress port of the electronic device 100 and then processed by the processing circuit 120. For example, one of the search clients parses a portion of a header in the packet and provides the header information to the search system 130.

[0053] At S315, a search key is generated. For example, the search key generation unit 131 generates a search key based on header information provided by the search client.

[0054] At S320, the search key is provided to both the TCAM cache engine 140 and the SRAM search engine 150. The TCAM cache engine 140 and the SRAM search engine 150 perform a lookup operation based on the search key, respectively.

[0055] At S325, when the TCAM cache engine 140 has a TCAM hit (the TCAM cache engine 140 has a matching entry for the search key other than the default entry), the process proceeds to S330; otherwise, the process proceeds to S335. In one example, when the packet is the first packet in the packet flow, the TCAM cache engine 140 has a TCAM miss (the TCAM cache engine 140 does not have a matching entry for the search key other than the default entry); and when the packet is one of the subsequent packets in the packet flow, the TCAM cache engine 140 has a TCAM hit (the TCAM cache engine 140 has a matching entry for the search key other than the default entry).

[0056] At S330, the aging table is updated. In one example, when the TCAM cache engine 140 has a matching TCAM entry for the search key, the output controller 160 provides the index of the matching TCAM entry to the maintenance controller 170, and the maintenance controller 170 updates the aging table to indicate that the matching TCAM entry has a hit activity. Then, the process proceeds to S350.

[0057] At S335, the output controller 160 receives the output signal 145 indicating a TCAM miss, and the output controller 160 waits for the SRAM search engine 150 to generate an output signal 155. When the SRAM search engine 150 finds a lookup entry with a key that matches the search key, the SRAM search engine 150 generates the output signal 155. In some examples, the output signal 155 includes an action code for a matching lookup entry, and the input signal 155 indicates a matching lookup entry (also referred to as an SRAM hit entry), such as an index of the matching lookup entry. The output controller 160 provides the index of the matching lookup entry to the maintenance controller 170.

[0058] At S340, the maintenance controller 170 selects a TCAM entry for replacement based on the aging table. For example, the maintenance controller 170 selects a TCAM entry that does not have a hit activity.

[0059] At S345, the maintenance controller 170 caches the matching lookup entry from the SRAM search engine 150 into the TCAM cache engine 140. For example, the maintenance controller 170 copies the key in the matching lookup entry into the selected TCAM entry and copies the action code into the memory space pointed to by the selected TCAM entry.

[0060] At S350, the output controller 160 generates an output signal 165 using the action code, and the search client receives the action code and performs an action on the packet based on the action code. Then, the process returns to S310 to receive the next packet.

[0061] It should be noted that in some examples, some steps in process 300 are performed by different components, and thus different components may perform these steps simultaneously with process 300 or in a different order.

[0062] Figure 4 A flow chart outlining a process 400 performed by a maintenance controller in an electronic device (eg, maintenance controller 170 in electronic device 100) according to one embodiment of the present disclosure is shown. The process starts at S401 and proceeds to S410.

[0063] At S410, the maintenance controller 170 periodically resets the aging bits for the TCAM entries. In one example, the maintenance controller 170 maintains an aging table for the TCAM cache engine 140. For example, the maintenance controller 170 allocates two aging bits for each TCAM entry. Note that other suitable aging tracking techniques may be used.

[0064] At S420, the maintenance controller 170 receives TCAM hit / miss information from the output controller 165. In one example, each time the TCAM cache engine 140 has a TCAM hit, the output controller 160 provides a signal indicating a TCAM hit and an index of a TCAM hit entry to the maintenance controller 170. However, each time the TCAM cache engine 140 has a TCAM miss, the output controller 160 provides a signal indicating a TCAM miss to the maintenance controller 170; then, when the output controller 160 receives SRAM hit information, the output controller 160 provides the SRAM hit information (such as an index of the SRAM hit entry) to the maintenance controller 170. When the TCAM cache engine 140 has a TCAM miss, the process proceeds to S430; otherwise, the process proceeds to S440.

[0065] At S430 , the maintenance controller 170 selects a TCAM entry for replacement based on the aging table. For example, the maintenance controller 170 selects a TCAM entry whose two aging bits are both zero.

[0066] At S435, the maintenance controller 170 copies the key in the matching lookup entry in the SRAM search engine 150 to the selected TCAM entry, and copies the action code to the memory space pointed to by the selected TCAM entry. In addition, in one example, the maintenance controller 170 sets one of the two aging bits of the selected TCAM entry to binary 1 to avoid race conditions.

[0067] At S440 , the TCAM cache engine 140 has a TCAM hit entry, and the maintenance controller 170 sets, for example, two aging bits for the TCAM hit entry to binary 1.

[0068] At S450 , before the periodic reset time, the process returns to S420 to check the next search result; and when the periodic reset time comes, the process returns to S410 to reset the aging bit for the TCAM entry.

[0069] Although aspects of the present disclosure have been described in conjunction with specific embodiments of the present disclosure proposed as examples, the examples may be replaced, modified, and varied. Accordingly, the embodiments described herein are intended to be illustrative rather than restrictive. Changes may be made without departing from the scope of the appended claims.

Claims

1. A network device, comprising: a search engine configured to store a lookup table of entries for packet processing rules and to search the lookup table in response to a packet received from a network interface of the network device; a ternary content addressable memory (TCAM) cache engine, the TCAM cache engine being configured to be searched in parallel with the search engine, the TCAM cache engine being configured to cache a subset of the entries in the lookup table based on hit statistics of the entries; a search key generating unit configured to generate a search key based on the received packet and to provide the search key to the search engine and the TCAM cache engine separately; as well as An output controller is configured to output a first search result received from the TCAM cache engine without waiting for a second search result to be received from the search engine, the received first search result indicating a matching entry for the search key.

2. The network device according to claim 1, further comprising: A maintenance controller is configured to selectively mirror the subset of the entries from the search engine to the TCAM cache engine based on the hit statistics.

3. The network device according to claim 2, wherein: The output controller is configured to: output the second search result from the search engine when the TCAM cache engine does not have a matching entry for the search key; and The maintenance controller is configured to selectively mirror a specific entry corresponding to the second search result from the search engine to the TCAM cache engine.

4. The network device according to claim 3, wherein: The maintenance controller is configured to maintain an aging table having bits corresponding to the subset of the entries to track hit activity for the subset of the entries in the TCAM cache engine.

5. The network device according to claim 4, wherein: The maintenance controller is configured to select a TCAM entry and replace the TCAM entry with the specific entry corresponding to the second search result based on the aging table.

6. The network device according to claim 5, wherein The maintenance controller is configured to set one of two bits corresponding to the selected TCAM entry to binary 1 to inhibit the selected TCAM entry from being immediately replaced next time.

7. The network device according to claim 4, wherein The maintenance controller is configured to set a bit corresponding to the matching entry in the aging table to binary 1.

8. The network device according to claim 4, wherein: The maintenance controller is configured to periodically reset bits in the aging table to binary zeros.

9. The network device according to claim 1, wherein the search engine comprises at least one of a statistical static random access memory (SRAM) and a dynamic random access memory (DRAM).

10. A method for searching in a network device, comprising: A lookup table storing entries for packet processing rules by the search engine; caching, by a ternary content addressable memory (TCAM) cache engine, a subset of the entries in the lookup table based on hit statistics of the entries; providing a search key to the search engine and to the TCAM cache engine separately, the search key being generated based on the received packet; as well as A first search result received from the TCAM cache engine is output without waiting for a second search result to be received from the search engine, the first search result received indicating a matching entry for the search key.

11. The method according to claim 10, further comprising: The subset of the entries is selectively mirrored from the search engine to the TCAM cache engine based on the hit statistics.

12. The method according to claim 11, further comprising: When the TCAM cache engine does not have a matching entry for the search key, outputting the second search result from the search engine; as well as A specific entry corresponding to the second search result is selectively mirrored from the search engine to the TCAM cache engine.

13. The method according to claim 12, further comprising: An aging table having bits corresponding to the subset of the entries is maintained to track hit activity for the subset of the entries in the TCAM cache engine.

14. The method according to claim 13, further comprising: selecting a TCAM entry based on the aging table; as well as The selected TCAM entry is replaced with the specific entry corresponding to the second search result.

15. The method according to claim 14, further comprising: One of the two bits corresponding to the selected TCAM entry is set to binary 1 to prohibit the selected TCAM entry from being immediately replaced next time.

16. The method according to claim 13, further comprising: The bit corresponding to the matching entry in the aging table is set to binary 1 to track the hit activity of the matching entry.

17. The method according to claim 13, further comprising: The bits in the aging table are reset to zero periodically.

18. An electronic device, comprising: a search engine configured to store a lookup table of entries for the rules; a ternary content addressable memory (TCAM) cache engine, the TCAM cache engine being configured to be searched in parallel with the search engine, the TCAM cache engine being configured to cache a subset of the entries in the lookup table based on hit statistics of the entries; a search key generating unit configured to generate a search key in response to a request from a search client and to separately provide the search key to the search engine and the TCAM cache engine; as well as An output controller is configured to output a first search result received from the TCAM cache engine without waiting for a second search result to be received from the search engine, the received first search result indicating a matching entry for the search key.

Citation Information

Patent Citations

  • Method and apparatus for updating replacement policy information for a fully associative buffer cache

    US20170046278A1

  • Efficient lookup of TCAM-like rules in ram

    US20170052731A1

  • Thomas blanchard

    US9A