Storage control device and method for TCAM (Ternary Content Addressable Memory) array
By configuring the cache module and processing control module to dynamically adjust the splicing relationship of the TCAM array, the problem of single splicing relationship of the TCAM array in different application scenarios is solved, and a larger search bit width and more entries are achieved, adapting to the needs of multiple scenarios, and having flexible upgrade space.
Patent Information
- Application Number
- CN202510528844.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-08
AI Technical Summary
TCAM arrays have a single splicing relationship in different application scenarios, which cannot adapt to diversified needs, resulting in limited flexibility and upgrade space.
By configuring the cache module and processing control module, the splicing relationship of the TCAM array is dynamically adjusted, cascading and stacking splicing are supported, and the TCAM lookup table specifications are flexibly configured to achieve flexible configuration of multiple splicing specifications.
It realizes that the search bit width of the TCAM array is larger and/or more entries, adapts to the needs of multiple scenarios, has flexible upgrade space and high flexibility, and adapts to protocol development and business scenario changes.
Smart Images

Figure CN120448598A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of chip storage technology, and in particular relates to a storage control device and method for a TCAM array. Background Art
[0002] TCAM (Ternary Content Addressable Memory) is short for ternary content addressable memory. Its principle is to use the keyword key to match the content stored in all entries in the TCAM. If the content stored in the entry matches the keyword, the matching entry index number is output as the search result to form a lookup table (LUT). Summary of the Invention
[0003] The purpose of the present application is to provide a storage control device and method for a TCAM array, aiming to solve the problem in the related art that the TCAM splicing relationship in the TCAM array is single and cannot adapt to different application scenarios.
[0004] According to a first aspect of the present application, a storage control device for a TCAM array is provided, comprising: a TCAM array, a configuration cache module, and a processing control module;
[0005] The TCAM array includes multiple TCAMs for storing data;
[0006] A configuration cache module is used to store TCAM control information configured for the TCAM array, where the TCAM control information is used to indicate a splicing relationship between each TCAM and other TCAMs;
[0007] The processing control module is used to read TCAM control information from the configuration cache module and obtain the query hit result of each TCAM in the TCAM array when performing data query on the TCAM array, and output the final hit result of the TCAM array according to the TCAM control information and the query hit result.
[0008] In this embodiment, both the configuration cache module and the processing control module can be implemented on the periphery of the TCAM array, without modifying the internal structure of the TCAM. By configuring the splicing relationship between the TCAMs in the TCAM array through software, the specifications of the lookup table (LUT) of the TCAM array to be used can be adjusted, so that the LUT has a larger search bit width and / or a larger number of entries. The present application also caches the control information configured for the TCAM array, and reads the corresponding control information from the configuration cache module during table lookup. The configuration cache module can be a register or an SRAM. By reading the configured control information from the configuration cache module each time, the specifications of the TCAM array can be dynamically adjusted and can be applied to a variety of scenarios, including but not limited to network packet lookup based on flow matching, algorithm lookup, address matching, etc. In addition, the solution of the present application has flexible upgrade space and can be upgraded after the chip is returned. After the chip is manufactured, it still faces new requirements caused by protocol development and changes in business scenarios. The hardware device of the present application can change the splicing specifications of the TCAM array by changing the configuration through software, so that the chip adapts to new requirements or solves existing problems.
[0009] In an optional embodiment, the TCAM control information includes cascade control identification information and stacking control identification information; the cascade control identification information is used to configure the cascade splicing relationship between the TCAM and other TCAMs; the stacking control identification information is used to configure the stacking splicing relationship between the TCAM and other TCAMs;
[0010] The processing control module determines the combined hit result of the TCAM based on the cascade control identification information and the query hit result, updates the combined hit result of the TCAM based on the stacking control identification information, and outputs the final hit result of the TCAM array according to the combined hit result.
[0011] This embodiment supports flexible configuration of multiple different splicing specifications and can be flexibly set from one TCAM to multiple TCAMs. Compared with the solution that can only select one of the specific specifications, it has higher flexibility.
[0012] In an optional embodiment, the processing control module traverses the TCAMs in the TCAM array and, when determining based on the cascade control identification information that the currently traversed TCAM does not have a cascade splicing relationship, assigns a combined hit result of the currently traversed TCAM as a corresponding query hit result;
[0013] When the processing control module determines that the currently traversed TCAM has a cascade splicing relationship and is a selected TCAM in the cascade splicing relationship, the processing control module assigns a result of an AND operation of a query hit result of the selected TCAM and query hit results of other TCAMs in the cascade splicing relationship to the selected TCAM to a combined hit result of the selected TCAM;
[0014] When the processing control module determines that the currently traversed TCAM has a cascade splicing relationship and is not the selected TCAM in the cascade splicing relationship, the processing control module assigns the combined hit result of the currently traversed TCAM to all entries miss.
[0015] The processing control module proposed in this embodiment uses cascade control identification information to merge the query hit results of each TCAM, so that multiple query hit results of multiple TCAM blocks are merged into a combined hit result (that is, the combined hit result of the selected TCAM) to facilitate subsequent use.
[0016] In an optional embodiment, the processing control module traverses the TCAM in the TCAM array, and determines that the currently traversed TCAM has a stacking splicing relationship based on the stacking control identification information, and the currently traversed TCAM is not the first TCAM in the stacking splicing relationship to which it belongs, then the combination hit result corresponding to the previous TCAM is inverted and then an AND operation is performed on the combination hit result corresponding to the currently traversed TCAM, and the AND operation result is assigned to the combination hit result identified by the currently traversed TCAM.
[0017] The processing control module proposed in this embodiment uses the stacking control identification information to merge the query hit results of each TCAM, so that the same hit result will not appear in the combined hit results of multiple TCAM blocks forming a stacking splicing relationship, which is convenient for subsequent use.
[0018] In an optional embodiment, the processing control module traverses the combined hit results corresponding to each TCAM, and outputs the identifier of the TCAM corresponding to the combined hit result indicating that at least one entry is a hit and the index of at least one entry as the final hit result.
[0019] In this way, the hit results of the cascade splicing relationship and the stacked splicing relationship can be merged and output for easy subsequent use.
[0020] According to a second aspect of the present application, a storage control method for a TCAM array is provided, comprising:
[0021] When querying data on a TCAM array, TCAM control information is read from a configuration cache module. The TCAM array includes multiple TCAMs for storing data. The configuration cache module is used to store TCAM control information configured for the TCAM array. The TCAM control information is used to indicate the splicing relationship between each TCAM and other TCAMs.
[0022] Obtain query hit results for each TCAM in the TCAM array;
[0023] According to the TCAM control information and the query hit result, the final hit result of the TCAM array is output.
[0024] In an optional embodiment, the TCAM control information includes cascade control identification information and stacking control identification information; the cascade control identification information is used to configure the cascade splicing relationship between the TCAM and other TCAMs; the stacking control identification information is used to configure the stacking splicing relationship between the TCAM and other TCAMs;
[0025] Based on the TCAM control information and query hit results, the final hit result of the TCAM array is output, including:
[0026] Determine a combined hit result of the TCAM based on the cascade control identification information and the query hit result;
[0027] Update the combined hit result of the TCAM based on the stack control identification information;
[0028] The final hit result of the TCAM array is output according to the combined hit result.
[0029] In an optional implementation manner, determining a combined hit result of the TCAM based on the cascade control identification information and the query hit result includes:
[0030] Traversing the TCAMs in the TCAM array and, when determining, based on the cascade control identification information, that the currently traversed TCAM does not have a cascade splicing relationship, assigning a combination hit result of the currently traversed TCAM as a corresponding query hit result;
[0031] When it is determined that the currently traversed TCAM has a cascade splicing relationship and is a selected TCAM in the cascade splicing relationship, an AND operation result of a query hit result of the selected TCAM and query hit results of other TCAMs in the cascade splicing relationship to which the selected TCAM belongs is assigned to a combined hit result of the selected TCAM;
[0032] When it is determined that the currently traversed TCAM has a cascade splicing relationship and is not the selected TCAM in the cascade splicing relationship, the combined hit result of the currently traversed TCAM is assigned as all entries miss.
[0033] In an optional implementation manner, updating the combined hit result of the TCAM based on the stack control identification information includes:
[0034] Traversing the TCAMs in the TCAM array and determining, based on the stacking control identification information, that the currently traversed TCAM is in a stacking splicing relationship and that the currently traversed TCAM is not the first TCAM in the stacking splicing relationship to which it belongs, inverting the combination hit result corresponding to the previous TCAM and performing an AND operation on the combination hit result corresponding to the currently traversed TCAM;
[0035] The AND operation result is assigned to the combined hit result of the currently traversed TCAM identifier.
[0036] In an optional embodiment, outputting a final hit result of the TCAM array according to the TCAM control information and the query hit result includes:
[0037] The combined hit result corresponding to each TCAM is traversed, and the identifier of the TCAM corresponding to the combined hit result indicating that at least one entry is hit and the index of at least one entry are output as the final hit result.
[0038] A third aspect of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores a plurality of instructions, and the processor is configured to read the instructions and execute the method of the first aspect.
[0039] A fourth aspect of the present application provides a computer-readable storage medium, which stores a plurality of instructions. The plurality of instructions can be read by a processor and execute the method of the first aspect.
[0040] Other features and advantages of the present application will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present application. The purpose and other advantages of the present application can be achieved and obtained through the structures and processes indicated in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following is a brief introduction to the drawings required for use in the embodiments or related technical descriptions. It is obvious that the drawings described below are certain embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0042] Figure 1 FIG. 4 is a structural block diagram of a storage control device of a TCAM array according to an exemplary embodiment of the present application.
[0043] Figure 2 4 is a flowchart illustrating a cascade hit situation of a processing control module according to an exemplary embodiment of the present application.
[0044] Figure 34 is a flowchart illustrating a stack hit situation of a processing control module according to an exemplary embodiment of the present application.
[0045] Figure 4 4 is a flow chart of a storage control method of a TCAM array according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solutions and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0047] TCAM has the following characteristics:
[0048] 1) High concurrency: TCAM lookup can query all its internal entries at the same time.
[0049] 2) High speed: TCAM can operate at a clock frequency of 1 GHz, and some high-performance products may exceed 1 GHz.
[0050] 3) Flexibility: TCAM supports three states ("0", "1", or "X"). In the X state, inputting "0" or "1" will successfully match. Therefore, TCAM can support fuzzy matching and is very flexible in use.
[0051] TCAM plays a key role in network chips and is widely used in core products such as routers, switches, access control lists, and firewalls. TCAM not only builds routing tables, efficiently matches network packet content, and accurately determines forwarding paths, thereby improving network throughput, but also implements security rule tables, rapidly matching rules and determining packet security, thereby implementing security policy controls and enhancing network protection.
[0052] In related technologies, multiple TCAMs are integrated into a chip in the following ways:
[0053] 1) Each TCAM is used independently. This usage method results in the inability to expand the TCAM specifications, its application scenarios are fixed, and the upgrade space is limited.
[0054] 2) TCAM specifications are adjusted in a static manner. This approach can reduce complex logic design, but its disadvantage is that the adjustment is not flexible enough, especially not suitable for scenarios requiring packet flow matching in network chips.
[0055] 3) TCAM specifications are adjusted and used within a specific range. This usage method usually provides a 2N-block TCAM splicing mode, such as 2-block, 4-block, or 8-block TCAM splicing. This method is simple in design and flexible in adjustment. However, its disadvantage is that it has fewer modes and requires excessive TCAM resources in some scenarios, resulting in low utilization.
[0056] Based on the above analysis, see Figure 1 As shown, the present application exemplarily proposes a storage control device for a TCAM array, including: a TCAM array, a configuration cache module, and a processing control module:
[0057] The TCAM array includes multiple TCAMs for storing data;
[0058] A configuration cache module is used to store TCAM control information configured for the TCAM array, where the TCAM control information is used to indicate a splicing relationship between each TCAM and other TCAMs;
[0059] The processing control module is used to read TCAM control information from the configuration cache module and obtain the query hit result of each TCAM in the TCAM array when performing data query on the TCAM array, and output the final hit result of the TCAM array according to the TCAM control information and the query hit result.
[0060] Exemplarily, a TCAM array may include multiple TCAMs, with an unlimited number of TCAMs, i.e., not limited to 2N blocks. The TCAMs in the TCAM array may be general-purpose TCAMs, not specifically designated as a specific form of TCAM or TCAMs manufactured by a specific manufacturer. Each TCAM in the TCAM array has the same bit width and the same number of entries. The TCAM array includes N discrete TCAMs, which may be sequentially numbered 0 to (N-1) by hardware logic instantiation. The contents of the entries in the TCAMs are configured by software. The hardware logic generates N keywords with a bit width of W bits based on message type, scenario settings, etc., which are used to query each TCAM separately. N sets of query hit results are obtained after the query. The query hit results are used to indicate whether each entry in the corresponding TCAM is hit, and are typically represented by a vector TCAM_Hit_Vector. Each bit of the vector corresponds to an entry in the TCAM, and when a bit is 1, the entry corresponding to the bit indicates a hit.
[0061] Exemplarily, the splicing relationship of multiple TCAM blocks is not fixed and can be configured according to actual needs, with the configured TCAM control information stored in the configuration cache module. In some embodiments, the TCAM splicing relationship can include a cascade splicing relationship and a stacked splicing relationship. If the corresponding entry of each block in the multiple TCAM blocks forming the cascade splicing relationship is hit, the entry corresponding to the cascaded multiple TCAM blocks is considered to have hit. For example, if the TCAM control information configures four TCAM blocks, TCAM0-3, to be in a cascade splicing relationship, whether entry i is hit depends on whether entry i in each of the four TCAM blocks is hit. Furthermore, if the entry corresponding to any block in the multiple TCAM blocks forming the stacked splicing relationship is hit, the entry corresponding to the stacked multiple TCAM blocks is considered to have hit. For example, if the TCAM control information configures two TCAM blocks, TCAM4-5, to be in a stacked splicing relationship, whether entry j is hit depends on whether entry j in any of the two TCAM blocks is hit.
[0062] Exemplarily, during the data query process, the processing control module determines the final hit result of the TCAM array based on the TCAM control information read from the configuration cache module and the query hit result of each TCAM. The query hit result of each TCAM is used to indicate whether each entry in the TCAM is hit. For example, the query hit result can be represented by a vector TCAM_Hit_Vector, the bit width of which is equal to the number of entries in the TCAM, and each bit of the vector is used to indicate whether the corresponding entry in the TCAM is hit, for example, "1" indicates a hit, and "0" indicates a miss. The final hit result of the TCAM array includes the identifier of the TCAM hit by the current query (such as the number in the TCAM array) and the index of the hit entry in the hit TCAM.
[0063] In this embodiment, both the configuration cache module and the processing control module can be implemented on the periphery of the TCAM array, without modifying the internal structure of the TCAM. By configuring the splicing relationship between the TCAMs in the TCAM array through software, the specifications of the lookup table (LUT) of the TCAM array to be used can be adjusted, so that the LUT has a larger search bit width and / or a larger number of entries. The present application also caches the control information configured for the TCAM array, and reads the corresponding control information from the configuration cache module during table lookup. The configuration cache module can be a register or an SRAM. By reading the configured control information from the configuration cache module each time, the specifications of the TCAM array can be dynamically adjusted and can be applied to a variety of scenarios, including but not limited to network packet lookup based on flow matching, algorithm lookup, address matching, etc. In addition, the solution of the present application has flexible upgrade space and can be upgraded after the chip is returned. After the chip is manufactured, it still faces new requirements caused by protocol development and changes in business scenarios. The hardware device of the present application can change the splicing specifications of the TCAM array by changing the configuration through software, so that the chip adapts to new requirements or solves existing problems.
[0064] In some optional embodiments, the TCAM control information includes cascade control identification information and stacking control identification information; the cascade control identification information is used to configure the cascade splicing relationship between the TCAM and other TCAMs; the stacking control identification information is used to configure the stacking splicing relationship between the TCAM and other TCAMs;
[0065] The processing control module determines the combined hit result of the TCAM based on the cascade control identification information and the query hit result, updates the combined hit result of the TCAM based on the stacking control identification information, and outputs the final hit result of the TCAM array according to the combined hit result.
[0066] Exemplarily, the cascade control identifier information includes a 1-bit cascade control identifier corresponding to each TCAM block, and the stacking control identifier information includes a 1-bit stacking control identifier corresponding to each TCAM block. Therefore, for a TCAM array consisting of N TCAM blocks, the cache module is configured to store at least N bits of cascade control identifiers and N bits of stacking control identifiers.
[0067] Exemplarily, the configuration cache module can provide multiple sets of TCAM control information to adapt to different scenarios. Each time the table is looked up, the processing control module can extract a corresponding set of control information from the multiple sets of TCAM control information of the configuration cache module based on the index of the TCAM control information required by the current environment. The extracted control information is used to determine the combined hit result of each TCAM.
[0068] Exemplarily, the processing control module first determines the combined hit result of each TCAM based on the cascade control identification information in the extracted control information and the query hit result of each TCAM. The combined hit result can reflect the cascade hit situation of multiple TCAMs in a cascade splicing relationship, that is, for multiple TCAMs in the same cascade splicing relationship, when corresponding entries are all hit, the corresponding entry in the combined hit result of one of the multiple TCAMs is marked as a hit, while the corresponding entry in the combined hit results of other blocks in the multiple TCAMs is marked as a miss. In this way, for multiple TCAMs configured with a cascade splicing relationship, their hit results will be merged into the combined hit result of one of the TCAMs. In other words, the combined hit result reflects the cascade hit situation between TCAMs. If a TCAM forms a cascade splicing relationship with other TCAMs, the combined hit result of the TCAM will no longer be the same as its own query hit result due to the query hit results of other CAMs. If a TCAM does not form a cascade splicing relationship with other TCAMs, the combined hit result of the TCAM will still be its query hit result.
[0069] Exemplarily, based on the combined hit results of each TCAM, the processing control module uses the stacking control identification information to update the combined hit results obtained based on the cascade relationship. If a TCAM forms a stacked splicing relationship with other TCAMs, the processing control module updates the combined hit results of that TCAM based on the stacking situation. It should be noted that if a TCAM does not form a stacked splicing relationship with other TCAMs, the combined hit results of that TCAM may not be updated, or the combined hit results may remain unchanged before and after the update. Finally, the processing control module outputs the TCAM corresponding to the combined hit result with a hit entry and the index of the hit entry as the final hit result of the TCAM array.
[0070] This embodiment supports flexible configuration of multiple different splicing specifications and can be flexibly set from one TCAM to multiple TCAMs. Compared with the solution that can only select one of the specific specifications, it has higher flexibility.
[0071] In some optional embodiments, the processing control module traverses the TCAMs in the TCAM array and, when determining based on the cascade control identification information that the currently traversed TCAM does not have a cascade splicing relationship, assigns a combined hit result of the currently traversed TCAM as a corresponding query hit result;
[0072] When the processing control module determines that the currently traversed TCAM has a cascade splicing relationship and is a selected TCAM in the cascade splicing relationship, the processing control module assigns a result of an AND operation of a query hit result of the selected TCAM and query hit results of other TCAMs in the cascade splicing relationship to the selected TCAM to a combined hit result of the selected TCAM;
[0073] When the processing control module determines that the currently traversed TCAM has a cascade splicing relationship and is not the selected TCAM in the cascade splicing relationship, the processing control module assigns the combined hit result of the currently traversed TCAM to all entries miss.
[0074] Exemplarily, the processing control module selects one of the multiple TCAMs forming a cascaded splicing relationship as a selected TCAM, and then merges the results of all corresponding entries being hit into the combined hit result of the selected TCAM, such as assigning "1" to the corresponding bits of the hit entries in the vector corresponding to the combined hit result, and assigning "0" to all other bits. The combined hit results of the other TCAMs in the cascaded splicing relationship are assigned as misses for all entries, such as assigning "0" to all bits of the vector corresponding to the combined hit result. For example, if TCAMs 0-3 are in a cascaded splicing relationship, and entries i and j of the four TCAMs are both hits, TCAM 3 may be selected, and entries i and j are marked as hits in the combined hit result of TCAM 3. All entries in the combined hit results of the other TCAMs 0-2 are assigned misses. Therefore, for the multiple TCAMs in the cascaded splicing relationship, the output hit result is TCAM 3 and entries i and j.
[0075] For example, for a TCAM that does not exist in any cascade splicing relationship, its combined hit result is the same as the query hit result.
[0076] The following describes in detail the process of merging hit results of the cascade splicing relationship through a hardware logic implementation of the processing control module.
[0077] See also Figure 2As shown, it exemplarily shows the hardware logic implementation process of the processing control module using the cascade control identification information to calculate the combined hit results of the TCAMs numbered m-1, m and m+1. Among them, TCAM_Cas_cfg[m] represents the cascade control identification of the TCAM numbered m in the cascade control identification information. The value of 1 indicates that the corresponding TCAM is the first TCAM in the cascade splicing relationship. For example, if the TCAMs numbered m-1, m and m+1 form a cascade splicing relationship, then the TCAM numbered m is the first TCAM in the cascade splicing relationship. If the TCAMs numbered m+3 and m+4 form a new cascade splicing relationship, then the TCAM numbered m+3 is the first TCAM in the new cascade splicing relationship. If TCAM_Cas_cfg[m] is 0, it indicates that the corresponding TCAM is not the first TCAM in the cascade splicing relationship, but forms a cascade splicing relationship with its previous TCAM, for example, the TCAM numbered m+1 forms a cascade splicing relationship with the TCAM numbered m. It should be noted that in order to adapt to Figure 2 In the processing process of the hardware logic shown, the cascade control flag corresponding to the TCAM that does not form a cascade splicing relationship with other TCAMs is also assigned a value of "1".
[0078] TCAM_Hit_Vector[m-1] represents the query hit vector of TCAM numbered m-1. The bit width of the query hit vector is consistent with the number of entries in the TCAM. That is, each bit represents the hit status of a TCAM entry. A value of 1 indicates a hit for the corresponding entry, and a value of 0 indicates a miss for the corresponding entry.
[0079] New_Hit_Vector[m] represents the bitwise OR of TCAM_Cas_cfg[m] and TCAM_Hit_Vector[m-1], and then the bitwise AND of TCAM_Hit_Vector[m]. The logical meaning of this operation is that the New_Hit_Vector of the first TCAM in the cascade splicing relationship is its query hit result, while the New_Hit_Vector of the non-first TCAM is the bitwise AND of its query hit result and the query hit result of its previous TCAM.
[0080] Level1_Hit_Vector[m] is a vector representation of the combined hit result of number m obtained according to the cascade splicing relationship. This vector is the bitwise AND result of New_Hit_Vector[m] and TCAM_Cas_cfg[m+1]. Its logical meaning is: if TCAM_Cas_cfg[m+1] is 1, it means that TCAM[m+1] is the first TCAM in the new cascade splicing relationship or does not form a cascade relationship with any TCAM. It is no longer cascaded with TCAM[m], that is, it is no longer a TCAM in the current cascade splicing relationship. Therefore, TCAM[m] is the last TCAM in the current cascade splicing relationship. Therefore, the combined hit result Level1_Hit_Vector[m] of the last TCAM is assigned to New_Hit_Vector[m], which is equivalent to merging the hit conditions of all TCAMs in the current cascade splicing relationship into the combined hit result of the last TCAM. At this time, the cascade hit flag Level1_Hit_Flag[m] of the last TCAM will also be set to valid; if TCAM_Cas_cfg[m+1] is 0, it means that TCAM[m+1] is cascaded with TCAM[m] and is still the TCAM in the current cascade splicing relationship, so TCAM[m] is not the last TCAM in the current cascade splicing relationship, so its combined hit result will be assigned to 0, and the corresponding cascade hit flag Level1_Hit_Flag[m] will also be assigned to invalid.
[0081] Level1_Hit_Flag[m] is the cascade hit flag (1Bit) of the TCAM numbered m. If the flag is 1, it means there is a hit entry in the TCAM numbered m, and if it is 0, it means there is no hit entry. This flag is the result of bitwise OR of the corresponding combined hit result Level1_Hit_Vector[m]. It should be noted that, regardless of whether a cascade splicing relationship is formed with other TCAMs, the corresponding cascade hit flags are the results of bitwise OR of the corresponding combined hit results.
[0082] according to Figure 2The logic shown is that the process of the processing control module according to the cascade control identification information is roughly as follows: the TCAM in the current cascade splicing relationship is considered to be hit only when the same entry of each TCAM in the cascade control identification information is hit; the operation at the hardware level is to determine whether each TCAM in the cascade control identification information is the first TCAM. If it is not the first TCAM, the query hit result TCAM_Hit_Vector of the TCAM is bitwise ANDed with the query hit result TCAM_Hit_Vector of the TCAM with a smaller number, until the last TCAM in the cascade splicing relationship, and the result obtained at this time is the new New_Hit_Vector; if it is the first TCAM, the query hit result TCAM_Hit_Vector of the first TCAM is directly used as the New_Hit_Vector.
[0083] Based on the above operations, the processing control module also determines whether each TCAM is the last TCAM in the cascade splicing relationship. If it is the last TCAM, the New_Hit_Vector corresponding to the last TCAM is used as the combined hit result Level1_Hit_Vector of the last TCAM. If it is not the last one, the combined hit result of the TCAM is assigned a value of 0.
[0084] The processing control module proposed in this embodiment uses cascade control identification information to merge the query hit results of each TCAM, so that multiple query hit results of multiple TCAM blocks are merged into a combined hit result (that is, the combined hit result of the selected TCAM) to facilitate subsequent use.
[0085] In some optional embodiments, the processing control module traverses the TCAM in the TCAM array, and determines that the currently traversed TCAM has a stacking splicing relationship based on the stacking control identification information, and the currently traversed TCAM is not the first TCAM in the stacking splicing relationship to which it belongs, then the combination hit result corresponding to the previous TCAM is inverted and then an AND operation is performed on the combination hit result corresponding to the currently traversed TCAM, and the AND operation result is assigned to the combination hit result identified by the currently traversed TCAM.
[0086] For example, the processing control module uses the stacking control identification information to update the combined hit result. This is to merge the query hit results of multiple TCAMs that form a stacked and spliced relationship and reflect them in the combined hit result. This allows the final hit result of the TCAM array to be derived based on the final combined hit result. For TCAMs that are not in a stacked and spliced relationship, their combined hit results are not updated during this process, or in other words, remain unchanged before and after the update.
[0087] Exemplarily, the processing control module traverses multiple TCAMs that form a stacked splicing relationship, and determines the combined hit results during the traversal process. If an entry is found to be a hit for the first time, the entry is marked as a hit in the combined hit result of the currently traversed TCAM, while the entry is marked as a miss in the combined hit results corresponding to other TCAMs that belong to the same stacked-level splicing relationship that are traversed subsequently. In this way, the situation where the same entry is hit in multiple TCAMs that have a stacked splicing relationship will only appear in the combined hit result of one TCAM, that is, the situation where multiple TCAMs in the stacked splicing relationship hit the same entry at the same time will be merged in the combined hit result.
[0088] The following describes in detail the process of merging hit results of stacking and splicing relationships by implementing a hardware logic of the processing control module.
[0089] See also Figure 3 As shown, it exemplarily shows the hardware logic implementation process of the processing control module using the stacking control identification information to update the combined hit results of the TCAMs numbered m-1, m and m+1. It should be noted that if m-1, m and m+1 are in a cascaded splicing relationship, a stacking splicing relationship can no longer be formed, but the three cascaded TCAMs can further form a stacking splicing relationship with other separate TCAMs or multiple TCAMs after cascading. Among them, TCAM_Stack_Cfg[m] represents the stacking control identifier of the TCAM numbered m in the stacking control identification information. If the value is 1, it indicates that the corresponding TCAM is the first TCAM in the stacking splicing relationship. If it is 0, it indicates that the corresponding TCAM is not the first TCAM in the stacking splicing relationship, but forms a stacking splicing relationship with the previous TCAM. It should be noted that in order to adapt to Figure 3 In the hardware logic shown, the stacking control flag corresponding to the TCAM that does not form a stacking splicing relationship with any TCAM is also assigned a value of "1".
[0090] Level2_Hit_Mask[m-1] represents the hit vector mask of the TCAM numbered m. If the TCAM numbered m-1 is the first block in the stacked splicing relationship, Level2_Hit_Mask[m-1] defaults to 0, otherwise it is the combined hit result after the TCAM with a smaller number is updated; Level2_Hit_Mask[m-1] is an intermediate variable value, which is used to mask the valid bits of the cascade hit mark Level1_Hit_Flag when the processing control module uses the cascade control identification information for processing.
[0091] Level2_Hit_Vector[m] is the updated combined hit vector of TCAM numbered m.
[0092] according to Figure 3 The logic shown, the process of the processing control module according to the stacking control identification information is roughly as follows: if any TCAM in the current stacking splicing relationship in the stacking control identification information hits, it is considered a hit; starting from the TCAM with the smallest number in the current stacking splicing relationship in the stacking control identification information, the TCAM_Stack_Cfg[m] of the TCAM with the smallest number is 1, and the combined hit result Level1_Hit_Vector obtained in the cascade processing process is judged. If the vector is non-zero, it means a stacking hit, and the corresponding hit vector mask Level2_Hit_Mask is valid after being inverted (that is, the Level2 _Hit_Mask corresponding to the hit entry is 1), then the combined hit result Level1_Hit_Vector is the same before and after the update. If the corresponding hit vector mask Level2_Hit_Mask is invalid after being inverted, the bit corresponding to the hit entry in the combined hit result will be assigned a value of 0. This is because the situation of the hit entry has been reflected in the combined hit result of the previous TCAM and will no longer be reflected in the combined hit result of the current TCAM. If the vector is 0, it means that there is no stack hit, and the next TCAM with a larger number will continue to be judged in this way until the last TCAM in the stack control identification information. Figure 3 It can be seen that if the TCAM is the first TCAM in the current stacking and splicing relationship, the inversion of TCAM_Stack_Cfg is invalid, so the updated combined hit result Level2_Hit_Vector is the same as the combined hit result Level1_Hit_Vector before the update; if the TCAM is not the first TCAM in the current stacking and splicing relationship, and the hit vector mask Level2_Hit_Mask and the cascade hit flag Level1_Hit_Flag of the previous TCAM are both 0, then the result of the OR operation of the two is still 0, so the updated combined hit result Level2_Hit_Vector of the TCAM is also the same as the combined hit result Level1_Hit_Vector before the update. Therefore, for non-first TCAM, if one of the hit vector mask Level2_Hit_Mask and the cascade hit flag Level1_Hit_Flag of the previous TCAM is valid, the bit of the corresponding hit entry in the combined hit result before the update will be assigned to 0. This is because in the stacking splicing relationship, the combined hit result of the previous TCAM has been marked as a hit entry, and is masked in the subsequent TCAMs belonging to the same stacking splicing relationship, that is, marked as a miss. In this way, the hit mark can be merged into the combined hit result of the first TCAM that is traversed to a hit in the stacking splicing relationship.
[0093] The processing control module proposed in this embodiment uses the stacking control identification information to merge the query hit results of each TCAM, so that the same hit result will not appear in the combined hit results of multiple TCAM blocks forming a stacking splicing relationship, which is convenient for subsequent use.
[0094] In some optional embodiments, the processing control module traverses the combined hit results corresponding to each TCAM, and outputs the identifier of the TCAM corresponding to the combined hit result indicating that at least one entry is a hit and the index of at least one entry as the final hit result.
[0095] For example, Figure 3 For example, it can be determined whether the Level2_Hit_Vector of each TCAM is 0. If it is not 0, it means that there is an entry that is hit. It can be determined that the TCAM is hit, and the identifier of the TCAM is used as the final hit identifier (TCAM_ID); continue to use the Level2_Hit_Vector where the entry is hit, start from the lowest bit and judge bit by bit to find the bit with a value of 1 (indicating a hit), and the index of the bit is used as the final hit index (Hit_Index).
[0096] In this way, the hit results of the cascade splicing relationship and the stacked splicing relationship can be merged and output for easy subsequent use.
[0097] See also Figure 4 , the present application also exemplarily provides a storage control method for a TCAM array, including:
[0098] Step S401: When performing a data query on a TCAM array, TCAM control information is read from a configuration cache module. The TCAM array includes multiple TCAMs for storing data. The configuration cache module is configured to store TCAM control information configured for the TCAM array. The TCAM control information is used to indicate the splicing relationship between each TCAM and other TCAMs.
[0099] Step S402: Obtain query hit results for each TCAM in the TCAM array;
[0100] Step S403: Outputting the final hit result of the TCAM array according to the TCAM control information and the query hit result.
[0101] In some optional embodiments, the TCAM control information includes cascade control identification information and stacking control identification information; the cascade control identification information is used to configure the cascade splicing relationship between the TCAM and other TCAMs; the stacking control identification information is used to configure the stacking splicing relationship between the TCAM and other TCAMs;
[0102] Based on the TCAM control information and query hit results, the final hit result of the TCAM array is output, including:
[0103] Determine a combined hit result of the TCAM based on the cascade control identification information and the query hit result;
[0104] Update the combined hit result of the TCAM based on the stack control identification information;
[0105] The final hit result of the TCAM array is output according to the combined hit result.
[0106] In some optional embodiments, determining a combined hit result of the TCAM based on the cascade control identification information and the query hit result includes:
[0107] Traversing the TCAMs in the TCAM array and, when determining, based on the cascade control identification information, that the currently traversed TCAM does not have a cascade splicing relationship, assigning a combination hit result of the currently traversed TCAM as a corresponding query hit result;
[0108] When it is determined that the currently traversed TCAM has a cascade splicing relationship and is a selected TCAM in the cascade splicing relationship, an AND operation result of a query hit result of the selected TCAM and query hit results of other TCAMs in the cascade splicing relationship to which the selected TCAM belongs is assigned to a combined hit result of the selected TCAM;
[0109] When it is determined that the currently traversed TCAM has a cascade splicing relationship and is not the selected TCAM in the cascade splicing relationship, the combined hit result of the currently traversed TCAM is assigned as all entries miss.
[0110] In some optional embodiments, updating the combined hit result of the TCAM based on the stack control identification information includes:
[0111] Traversing the TCAMs in the TCAM array and determining, based on the stacking control identification information, that the currently traversed TCAM is in a stacking splicing relationship and that the currently traversed TCAM is not the first TCAM in the stacking splicing relationship to which it belongs, inverting the combination hit result corresponding to the previous TCAM and performing an AND operation on the combination hit result corresponding to the currently traversed TCAM;
[0112] The AND operation result is assigned to the combined hit result of the currently traversed TCAM identifier.
[0113] In some optional embodiments, outputting a final hit result of the TCAM array according to the TCAM control information and the query hit result includes:
[0114] The combined hit result corresponding to each TCAM is traversed, and the identifier of the TCAM corresponding to the combined hit result indicating that at least one entry is hit and the index of at least one entry are output as the final hit result.
[0115] The above method can be implemented by the storage control device of the TCAM array provided in the above embodiment. For specific implementation methods, please refer to the description of the storage control device of the TCAM array in the above embodiment, which will not be repeated here.
[0116] It is understood that the circuit structures, names, and parameters described in the above embodiments are merely examples. Those skilled in the art may also readily conceive of combinations and adjustments to the structural features of the above embodiments as needed, and should not limit the concept of this application to the specific details of the above examples.
[0117] Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A storage control device for a TCAM array, characterized in that: include: TCAM array, configuration cache module and processing control module; The TCAM array includes a plurality of TCAMs for storing data; The configuration cache module is used to store TCAM control information configured for the TCAM array, where the TCAM control information is used to indicate a splicing relationship between each TCAM and other TCAMs; The processing control module is used to read the TCAM control information from the configuration cache module and obtain the query hit result of each TCAM in the TCAM array when performing data query on the TCAM array, and output the final hit result of the TCAM array based on the TCAM control information and the query hit result.
2. The storage control device of the TCAM array according to claim 1, wherein: The TCAM control information includes cascade control identification information and stacking control identification information; the cascade control identification information is used to configure the cascade splicing relationship between the TCAM and other TCAMs; the stacking control identification information is used to configure the stacking splicing relationship between the TCAM and other TCAMs; The processing control module determines the combined hit result of the TCAM based on the cascade control identification information and the query hit result, updates the combined hit result of the TCAM based on the stacking control identification information, and outputs the final hit result of the TCAM array according to the combined hit result.
3. The storage control device of the TCAM array according to claim 2, wherein: The processing control module traverses the TCAMs in the TCAM array and, when determining, based on the cascade control identification information, that the currently traversed TCAM does not have a cascade splicing relationship, assigns a combination hit result of the currently traversed TCAM as a corresponding query hit result; When the processing control module determines that the currently traversed TCAM has a cascade splicing relationship and is a selected TCAM in the cascade splicing relationship, the processing control module assigns a result of an AND operation of a query hit result of the selected TCAM and query hit results of other TCAMs in the cascade splicing relationship to the selected TCAM to a combined hit result of the selected TCAM; When the processing control module determines that the TCAM currently traversed has a cascade splicing relationship and is not a selected TCAM in the cascade splicing relationship, the processing control module assigns a combined hit result of the TCAM currently traversed as all entries miss.
4. The storage control device of a TCAM array according to claim 2 or 3, wherein: The processing control module traverses the TCAM in the TCAM array and determines, based on the stacking control identification information, that the currently traversed TCAM has a stacking splicing relationship, and that the currently traversed TCAM is not the first TCAM in the stacking splicing relationship to which it belongs, inverts the combination hit result corresponding to the previous TCAM and performs an AND operation on the combination hit result corresponding to the currently traversed TCAM, and assigns the AND operation result to the combination hit result identified by the currently traversed TCAM.
5. The storage control device of a TCAM array according to any one of claims 1 to 3, wherein: The processing control module traverses the combined hit results corresponding to each TCAM, and outputs the identifier of the TCAM corresponding to the combined hit result indicating that at least one entry is hit and the index of the at least one entry as a final hit result.
6. A storage control method for a TCAM array, characterized in that: include: When performing a data query on a TCAM array, TCAM control information is read from a configuration cache module; wherein the TCAM array includes a plurality of TCAMs for storing data; the configuration cache module is configured to store TCAM control information configured for the TCAM array, the TCAM control information being configured to indicate a splicing relationship between each TCAM and other TCAMs; Obtaining a query hit result for each TCAM in the TCAM array; Outputting a final hit result of the TCAM array according to the TCAM control information and the query hit result.
7. The storage control method of the TCAM array according to claim 6, wherein: The TCAM control information includes cascade control identification information and stacking control identification information; the cascade control identification information is used to configure the cascade splicing relationship between the TCAM and other TCAMs; the stacking control identification information is used to configure the stacking splicing relationship between the TCAM and other TCAMs; Outputting a final hit result of the TCAM array according to the TCAM control information and the query hit result includes: Determining a combined hit result of the TCAM based on the cascade control identification information and the query hit result; Updating the combined hit result of the TCAM based on the stack control identification information; The final hit result of the TCAM array is output according to the combined hit result.
8. The storage control method of the TCAM array according to claim 7, wherein: Determining a combined hit result of the TCAM based on the cascade control identification information and the query hit result includes: traversing the TCAMs in the TCAM array and, when determining, based on the cascade control identification information, that the currently traversed TCAM does not have a cascade splicing relationship, assigning a combination hit result of the currently traversed TCAM as a corresponding query hit result; When it is determined that the currently traversed TCAM has a cascade splicing relationship and is a selected TCAM in the cascade splicing relationship, an AND operation result of a query hit result of the selected TCAM and query hit results of other TCAMs in the cascade splicing relationship to which the selected TCAM belongs is assigned to a combined hit result of the selected TCAM; When it is determined that the TCAM currently traversed has a cascade splicing relationship and is not the selected TCAM in the cascade splicing relationship to which it belongs, the combined hit result of the TCAM currently traversed is assigned as all entries miss.
9. The storage control method of the TCAM array according to claim 7 or 8, characterized in that: Updating the combined hit result of the TCAM based on the stack control identification information includes: traversing the TCAMs in the TCAM array and, when determining, based on the stacking control identification information, that the currently traversed TCAM is in a stacking splicing relationship and the currently traversed TCAM is not the first TCAM in the stacking splicing relationship, inverting a combination hit result corresponding to a preceding TCAM and performing an AND operation on the combination hit result corresponding to the currently traversed TCAM; The AND operation result is assigned to the combined hit result of the TCAM identifier currently traversed.
10. The storage control method of a TCAM array according to any one of claims 6 to 8, wherein: Outputting a final hit result of the TCAM array according to the TCAM control information and the query hit result includes: The combined hit result corresponding to each TCAM is traversed, and the identifier of the TCAM corresponding to the combined hit result indicating that at least one entry is hit and the index of the at least one entry are output as the final hit result.