CN108664518B - Method and device for realizing table look-up processing - Google Patents

Method and device for realizing table look-up processing Download PDF

Info

Publication number
CN108664518B
CN108664518B CN201710210525.1A CN201710210525A CN108664518B CN 108664518 B CN108664518 B CN 108664518B CN 201710210525 A CN201710210525 A CN 201710210525A CN 108664518 B CN108664518 B CN 108664518B
Authority
CN
China
Prior art keywords
entry
crc
key value
table lookup
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710210525.1A
Other languages
Chinese (zh)
Other versions
CN108664518A (en
Inventor
王林滨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sanechips Technology Co Ltd
Original Assignee
Sanechips Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sanechips Technology Co Ltd filed Critical Sanechips Technology Co Ltd
Priority to CN201710210525.1A priority Critical patent/CN108664518B/en
Priority to PCT/CN2018/079946 priority patent/WO2018177184A1/en
Publication of CN108664518A publication Critical patent/CN108664518A/en
Application granted granted Critical
Publication of CN108664518B publication Critical patent/CN108664518B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's

Abstract

A method and device for realizing table look-up processing comprises the following steps: determining whether an entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to a KEY (KEY) value of the entry; when the entry exists, determining the address of the matching table according to the calculation result of the CRC polynomial; determining an off-chip HASH (HASH) table look-up address according to a result returned after the determined address of the matching table is used for look-up of the matching table; and performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, and performing table lookup according to whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup. The method reduces the items needing table lookup, reduces the occupation of pin resources and bandwidth resources, and avoids the influence on the processing performance of the chip.

Description

Method and device for realizing table look-up processing
Technical Field
The present disclosure relates to, but not limited to, data processing technologies, and more particularly, to a method and an apparatus for performing table lookup processing.
Background
With the development of network technology, the number of related table entries that a network switch chip needs to support is increasing, and considering the cost factors of a Content Addressable Memory (CAM) and a Ternary Content Addressable Memory (TCAM), in the case of a large table entry, the related technology generally performs table lookup processing in a manner of using a plug-in double rate synchronous dynamic random access memory (DDR).
Because the plug-in DDR needs to consume more pin resources, the number of the plug-in DDR is limited, the access times of the DDR need to be reduced under the condition that the number of the DDR is limited, and the condition that HASH (HASH) table lookup is not successful and needs to be performed for multiple times is prevented; if a plurality of table entries coexist in a group of DDR, when different table entries need to be checked for many times, huge DDR access bandwidth is occupied, the table checking efficiency is limited, the processing of a chip is blocked, and the processing performance of the chip is greatly reduced.
In summary, for the case of a large number of table entries, the table lookup process occupies too many pin resources and bandwidth resources, and affects the processing performance of the chip.
Disclosure of Invention
The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
The embodiment of the invention provides a method and a device for realizing table lookup processing, which can reduce occupation of pin resources and bandwidth resources and avoid influence on chip processing performance.
The embodiment of the invention provides a method for realizing table look-up processing, which comprises the following steps:
determining whether the entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to the KEY value of the entry;
when the entry exists, determining the address of the matching table according to the calculation result of the CRC polynomial;
determining the off-chip HasH table look-up address according to the returned result after the determined matching table address is used for look-up of the matching table;
and performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, and performing table lookup according to whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup.
Optionally, the determining whether the entry exists includes:
performing a first preset time of the CRC polynomial calculation on the KEY value of the entry;
using the calculation result of the 0 th CRC polynomial as the address of the matching table to perform table lookup;
matching the result returned by the matching table lookup with the calculation results of other CRC polynomials except the 0 th CRC;
and when the result returned by the matching table lookup table is matched with the calculation result of other CRC polynomials except the 0 th CRC, determining that the entry exists.
Optionally, performing table lookup processing according to whether the KEY value of the entry is consistent with the KEY value returned by the hash table lookup includes:
the KEY value of the entry is consistent with the KEY value returned by the hash table lookup, and the entry is returned; and determining that the item is not hit when the KEY value of the item is inconsistent with the KEY value returned by the hash table lookup.
Optionally, the method further includes:
and when the result returned by the matching table lookup is not matched with the calculation results of other CRC polynomials except the 0 th CRC, the item is uploaded to a Central Processing Unit (CPU) for processing, or the item is processed according to a preset rule.
Optionally, before determining whether an entry exists through Cyclic Redundancy Check (CRC) polynomial calculation, the method further includes:
setting a second preset number MASK according to the entry related to the service;
for each item, selecting a MASK of a corresponding type according to a message analysis result, a service step and/or an application mode;
filtering invalid KEY values in the entries according to the selected MASK;
wherein, the message analysis result comprises the message type.
Optionally, before determining whether an entry exists through Cyclic Redundancy Check (CRC) polynomial calculation, the method further includes:
configuring a third preset bloom filter table;
performing CRC calculation on the KEY value of the entry to obtain a CRC result;
searching all bloom filter tables by using the CRC result to obtain a filter table result;
judging whether the entry exists according to the result of the filter table;
and when determining that the entry exists, continuing to look up the table, and when determining that the entry does not exist, stopping looking up the table.
Optionally, the configuring a third preset bloom filter table includes:
and configuring a third preset number of bloom filter tables according to the number of the entries supporting the conflict.
On the other hand, an embodiment of the present invention further provides a device for implementing table lookup, including: the device comprises a first judgment unit, a matching table address unit, a hash address unit and a table look-up processing unit; wherein the content of the first and second substances,
the first judging unit is used for: determining whether the entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to the KEY value of the entry;
the match table address unit is to: when the entry exists, determining the address of the matching table according to the calculation result of the CRC polynomial;
the hash address unit is to: determining the off-chip HasH table look-up address according to the returned result after the determined matching table address is used for look-up of the matching table;
the table look-up processing unit is used for: and performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, and performing table lookup according to whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup.
Optionally, the first determining unit is specifically configured to:
performing a first preset time of the CRC polynomial calculation on the KEY value of the entry;
using the calculation result of the 0 th CRC polynomial as the address of the matching table to perform table lookup;
matching the result returned by the matching table lookup with the calculation results of other CRC polynomials except the 0 th CRC;
and when the result returned by the matching table lookup table is matched with the calculation result of other CRC polynomials except the 0 th CRC, determining that the entry exists.
Optionally, the table lookup processing unit is specifically configured to:
performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, wherein the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup, and returning the entry; and determining that the item is not hit when the KEY value of the item is inconsistent with the KEY value returned by the hash table lookup.
Optionally, the table lookup processing unit is further configured to:
and when the result returned by the matching table lookup is not matched with the calculation results of other CRC polynomials except the 0 th CRC, the item is uploaded to a Central Processing Unit (CPU) for processing, or the item is processed according to a preset rule.
Optionally, the apparatus further includes a mask setting unit, a mask selecting unit, and a filtering unit; wherein the content of the first and second substances,
a set mask unit to: setting a second preset number MASK according to the entry related to the service;
the mask selection unit is to: for each item, selecting a MASK of a corresponding type according to a message analysis result, a service step and/or an application mode;
the filtering unit is used for: filtering invalid KEY values in the entries according to the selected MASK;
wherein, the message analysis result comprises the message type.
Optionally, the apparatus further includes a configuration unit, a second calculation unit, a second table look-up unit, a second determination unit, and a second processing unit; wherein the content of the first and second substances,
the configuration unit is used for: configuring a third preset bloom filter table;
the second calculation unit is configured to: performing CRC calculation on the KEY value of the entry to obtain a CRC result;
the second table look-up unit is used for: searching all bloom filter tables by using the CRC result to obtain a filter table result;
the second determination unit is configured to: judging whether the entry exists according to the result of the filter table;
the second processing unit is used for: and when determining that the entry exists, continuing to look up the table, and when determining that the entry does not exist, stopping looking up the table.
Optionally, the configuration unit is specifically configured to:
and configuring a third preset number of bloom filter tables according to the number of the entries supporting the conflict.
Compared with the related art, the technical scheme of the application comprises the following steps: determining whether an entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to a KEY (KEY) value of the entry; when the entry exists, determining the address of the matching table according to the calculation result of the CRC polynomial; determining an off-chip HASH (HASH) table look-up address according to a result returned after the determined address of the matching table is used for look-up of the matching table; and performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, and performing table lookup according to whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup. The method reduces the items needing table lookup, reduces the occupation of pin resources and bandwidth resources, and avoids the influence on the processing performance of the chip.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the example serve to explain the principles of the invention and not to limit the invention.
FIG. 1 is a flow chart of a method for implementing table lookup processing according to an alternative embodiment of the present invention;
FIG. 2 is a flow chart of a method for implementing table lookup processing according to another alternative embodiment of the present invention;
FIG. 3 is a flowchart of a method for implementing table lookup processing according to yet another alternative embodiment of the present invention;
FIG. 4 is a block diagram of an apparatus for implementing table lookup according to an embodiment of the present invention;
fig. 5 is a flowchart of a method of an application example of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
The steps illustrated in the flow charts of the figures may be performed in a computer system such as a set of computer-executable instructions. Also, while a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.
Fig. 1 is a flowchart of a method for implementing table lookup processing according to an embodiment of the present invention, as shown in fig. 1, including:
step 100, determining whether an entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to a KEY (KEY) value of the entry;
optionally, determining whether an entry exists comprises:
performing first preset CRC polynomial calculation on the KEY value of the entry;
using the calculation result of the 0 th CRC polynomial as the address of the matching table to perform table lookup;
matching the result returned by the table lookup of the matching table with the calculation results of other CRC polynomials except the 0 th CRC;
when the result returned by the matching table lookup table is matched with the calculation result of other CRC polynomials except the 0 th CRC, the existence of the entry is determined.
It should be noted that the first preset number may be determined by one skilled in the art according to the number of entries supporting conflict.
Step 101, when determining that an entry exists, determining a matching table address according to a calculation result of a CRC polynomial;
step 102, determining an off-chip Hash table look-up address according to a result returned after the determined matching table address is used for look-up of the matching table;
103, performing table lookup according to the determined off-chip HASH table lookup address to obtain a Hash table lookup return KEY value, and performing table lookup according to whether the KEY value of the entry is consistent with the Hash table lookup return KEY value or not;
optionally, performing table lookup processing according to whether the KEY value of the entry is consistent with the KEY value returned by the hash table lookup includes:
the KEY value of the entry is consistent with the KEY value returned by the hash table lookup, and the entry is returned; and determining that the item is not hit when the KEY value of the item is inconsistent with the KEY value returned by the hash table lookup.
Optionally, the method in the embodiment of the present invention further includes:
and when the result returned by the matching table lookup is not matched with the calculation results of other CRC polynomials except the 0 th CRC, the items are uploaded to a Central Processing Unit (CPU) for processing, or the items are processed according to a preset rule. The matching table in the embodiment of the invention can be arranged in an off-chip double rate synchronous dynamic random access memory (DDR).
Optionally, before step 100, the method according to the embodiment of the present invention may further include a processing procedure as shown in fig. 2:
step 200, setting a second preset MASK according to the related business of the entry;
step 201, for each item, selecting a MASK of a corresponding type according to a message analysis result, a service step and/or an application mode;
it should be noted that how to select the MASK of the corresponding type may be analyzed and set by those skilled in the art according to the message parsing result, the service step, and/or the application mode.
Step 202, filtering invalid KEY values in the entries according to the selected MASK;
the message parsing result may include a message type.
The embodiment of the invention reduces the occupation of pin resources and bandwidth resources and avoids the influence on the processing performance of the chip by filtering the invalid KEY values in the items. When the network looks up the table, the content of the KEY is designed to be more, for example, quintuple information is the most common information in TCP, and the embodiment of the invention can effectively filter useless content in the KEY through MASK, thereby preventing the error of the search result; for example, some entries are only related to IP addresses, and do not mask port number and other information, which will cause entry lookup errors; the embodiment of the invention can filter the composition content which is not needed to be considered in the item through MASK according to the service related to the item, thereby avoiding the condition that the item is stored in a plurality of positions because of the composition content which is not needed to be considered.
Optionally, before step 100, the method according to the embodiment of the present invention may further include a processing procedure as shown in fig. 3:
step 300, configuring a third preset bloom filter table;
optionally, configuring a third preset bloom filter table in the embodiment of the present invention includes:
configuring a third preset bloom filter table according to the number of the entries supporting the conflict;
it should be noted that the number of entries supporting conflicts can be obtained by empirically adding a margin after determining the maximum value through simulation in the related art. The bloom filter table of embodiments of the present invention may be placed in an on-chip Static Random Access Memory (SRAM).
301, performing CRC calculation on the KEY value of the entry to obtain a CRC result;
step 302, using the CRC result to search all bloom filter tables to obtain a filter table result;
step 303, judging whether an item exists according to the result of the filter table;
and step 304, continuously checking the table when determining that the entry exists, and stopping checking the table when determining that the entry does not exist.
The embodiment of the invention reduces the occupation of pin resources and bandwidth resources and avoids the influence on the processing performance of the chip by filtering the nonexistent entries. Judging whether the entries exist or not through a bloom filter, if not, directly sending the entries to a Central Processing Unit (CPU) for processing, and not wasting subsequent table lookup bandwidth; the bloom filter is generally implemented by using an on-chip Static Random Access Memory (SRAM);
in order to make the content of the embodiment of the present invention clear, the following describes the bloom filter:
the bloom filter generally performs multiple CRC calculations, queries a bloom filter table according to multiple CRC results, and exists only if all the bloom filter results obtained by the check of the multiple CRC results are 1 item; therefore, multiple table lookup is needed, and the situation of continuous processing in each period is generally not needed to be supported, so that the processing mode can be used; for example, if one is processed in 4 cycles, 4 CRC functions are used to calculate CRC values, and the result of the bloom setter table is searched, and only if all the results are hit, the subsequent processing is performed; otherwise, processing according to the condition of miss; the bloom filter table is used for processing the condition that a plurality of bits (bits) can exist in HASH (HASH) conflict, and the plurality of bits represent the number of the conflict; each bloom filter address supports 16 conflicts, and 16 bits are needed; at most, 16 table lookups are required to determine if an entry hits; if there is a requirement on the speed, the next read needs to be initiated if the read return of a Double Data Rate (DDR) cannot be waited, and in the worst case, the read bandwidth of the DDR will expand by 16 times, because the HASH collision probability is high, the range bandwidth of the DDR expands by more than 2 times, and for various types of entries in the DDR, the bandwidth expansion is unacceptable.
It should be noted that the processing procedures in steps 200 to 202 and the processing procedures in steps 300 to 304 may be applied simultaneously in the embodiment of the present invention, or may be implemented separately as an optional embodiment. In the embodiment of the invention, if the requirements on processing efficiency and precision are higher, a plurality of groups of bloom filter tables and a plurality of CRC functions can be used for processing, the subsequent processing is carried out only when all the bloom filters are hit, otherwise, the processing is carried out according to loss (MISS);
compared with the related art, the technical scheme of the application comprises the following steps: determining whether an entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to a KEY (KEY) value of the entry; when the entry exists, determining the address of the matching table according to the calculation result of the CRC polynomial; determining an off-chip HASH (HASH) table look-up address according to a result returned after the determined address of the matching table is used for look-up of the matching table; and performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, and performing table lookup according to whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup. The method reduces the items needing table lookup, reduces the occupation of pin resources and bandwidth resources, and avoids the influence on the processing performance of the chip.
The embodiment of the invention also provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used for executing the method for realizing the table look-up processing.
The embodiment of the invention also provides a device for realizing table look-up processing, which comprises: a memory and a processor; wherein the content of the first and second substances,
the processor is configured to execute program instructions in the memory;
the program instructions read on the processor to perform the following operations:
performing a first preset Cyclic Redundancy Check (CRC) polynomial calculation on a KEY (KEY) value of the entry;
using the calculation result of the 0 th CRC polynomial as the address of the matching table to perform table lookup;
matching the result returned by the table lookup with the calculation results of other CRC polynomials except the 0 th CRC;
when the result returned by table lookup is matched with the calculation result of other CRC polynomials, determining that the entry exists, and obtaining the off-chip Hash table lookup address according to the matching result;
when the off-chip Hash table lookup is returned, comparing whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup, and returning the entry when the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup; and determining that the item is not hit when the KEY value of the item is inconsistent with the KEY value returned by the hash table lookup.
Fig. 4 is a block diagram of a device for implementing table lookup according to an embodiment of the present invention, as shown in fig. 4, including: the device comprises a first judgment unit, a matching table address unit, a hash address unit and a table look-up processing unit; wherein the content of the first and second substances,
the first judging unit is used for: determining whether the entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to the KEY value of the entry;
the match table address unit is to: when the entry exists, determining the address of the matching table according to the calculation result of the CRC polynomial;
the hash address unit is to: determining the off-chip HasH table look-up address according to the returned result after the determined matching table address is used for look-up of the matching table;
the table look-up processing unit is used for: and performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, and performing table lookup according to whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup.
Optionally, the first determining unit is specifically configured to:
performing first preset CRC polynomial calculation on the KEY value of the entry;
using the calculation result of the 0 th CRC polynomial as the address of the matching table to perform table lookup;
matching the result returned by the table lookup of the matching table with the calculation results of other CRC polynomials except the 0 th CRC;
when the result returned by the matching table lookup table is matched with the calculation result of other CRC polynomials except the 0 th CRC, the existence of the entry is determined.
Optionally, the table lookup processing unit is specifically configured to:
performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, wherein the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup, and returning the entry; and determining that the item is not hit when the KEY value of the item is inconsistent with the KEY value returned by the hash table lookup.
Optionally, the table lookup processing unit is further configured to:
and when the result returned by the matching table lookup is not matched with the calculation results of other CRC polynomials except the 0 th CRC, the items are uploaded to a Central Processing Unit (CPU) for processing, or the items are processed according to a preset rule.
Optionally, the apparatus further includes a mask setting unit, a mask selecting unit, and a filtering unit; wherein the content of the first and second substances,
a set mask unit to: setting a second preset number of masks according to the entry related to the service;
the mask selection unit is to: for each item, selecting a MASK of a corresponding type according to a message analysis result, a service step and/or an application mode;
the filtering unit is used for: filtering invalid KEY values in the entries according to the selected MASK;
wherein, the message analysis result comprises the message type.
Optionally, the apparatus further includes a configuration unit, a second calculation unit, a second table look-up unit, a second determination unit, and a second processing unit; wherein the content of the first and second substances,
the configuration unit is used for: configuring a third preset bloom filter table;
the second calculation unit is configured to: performing CRC calculation on the KEY value of the entry to obtain a CRC result;
the second table look-up unit is used for: searching all bloom filter tables by using the CRC result to obtain a filter table result;
the second determination unit is configured to: judging whether the entry exists according to the result of the filter table;
the second processing unit is used for: and when determining that the entry exists, continuing to look up the table, and when determining that the entry does not exist, stopping looking up the table.
Optionally, the configuration unit is specifically configured to:
and configuring a third preset bloom filter table according to the number of the entries supporting the conflict.
Compared with the related art, the technical scheme of the application comprises the following steps: determining whether an entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to a KEY (KEY) value of the entry; when the entry exists, determining the address of the matching table according to the calculation result of the CRC polynomial; determining an off-chip HASH (HASH) table look-up address according to a result returned after the determined address of the matching table is used for look-up of the matching table; and performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, and performing table lookup according to whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup. The method reduces the items needing table lookup, reduces the occupation of pin resources and bandwidth resources, and avoids the influence on the processing performance of the chip.
The method of the present invention is described in clear detail by the following application examples, which are only used to illustrate and explain the present invention and are not used to limit the present invention.
Fig. 5 is a flowchart of an exemplary method of the present invention, as shown in fig. 5, including:
step 500, configuring MASK value, working mode and related enabling, etc.;
here, the operation mode, the related enable, and the like may be set according to an empirical value according to a technique in the art.
Step 501, initializing table contents of a bloom filter and matching the table contents;
step 502, after initialization is completed, receiving data which is input from outside and contains entries;
step 503, selecting a corresponding MASK value according to the type of the input data, and performing bit and operation on the KEY value of the data and the MASK to obtain a KEY value after the bit and operation;
step 504, performing two or more CRC polynomial calculations in parallel by using the bits and the KEY values obtained by the operation to obtain 4 CRC calculation results;
step 505, using 4 CRC values to check four corresponding bloom filter tables respectively;
step 506, checking four bloom filter tables to obtain return values of the four bloom filters;
step 507, judging whether the data is hit or not according to the return values of the four bloom filters; when the return values of the four bloom filters are all 1, the hit is represented, and when one of the return values of the four bloom filters is not 1, the miss is represented; on miss, go to step 516; if yes, go to step 508;
step 508, performing polynomial calculation of 8 different CRCs according to the KEY value to obtain CRC calculation results of 8 CRC polynomial calculations;
step 509, querying the matching table according to the calculation result of the 0 th CRC to obtain 16 matching values (values), comparing the first CRC with the 16 matching values, and outputting a 16-bit comparison result; this embodiment outputs a total of 16 x 7bit results;
and step 510, respectively sending out 7 final table lookup addresses obtained by CRC calculation according to the 16bit result.
Rule: if the first CRC is matched, obtaining a position deviation value according to a matching result with the highest priority; such as,
1. When the output comparison result is 0xffff, that is, all the values are matched, the 0 offset position takes effect, and the final table look-up output address of CRC1 is { CRC0, 4'd 0 };
2. when the output result is 0x0f x, the 4 th match with the highest priority is matched, the 4 offset position is effective, and the final table lookup output address of CRC1 is { CRC0, 4'd 4 };
3. when the output result is 0x0011, the highest-priority matching bit is matched with the 11 th bit, the 11 offset position takes effect, and the final table lookup output address of the CRC1 is { CRC0, 4'd 11 };
4. when the output result is 0x0002, the 14 th bit of the highest matching bit of the priority is matched, and the 14 offset position takes effect; the final CRC1 lookup table output address is { CRC0, 4'd 14 };
to sum up, in the embodiment of the present invention, the position of the first valid (1) is taken as the offset value; the subsequent effective bit is not effective;
if the CRC1 to CRC7 results are the same, the output result of the CRC1 is used when the CRC1 is valid, and the like is repeated, and if all the results are invalid, the processing is performed in a miss manner;
step 511, obtaining results of 7 CRCs 1 to 7;
step 512, judging whether the results of the 7 CRC1 to CRC7 are all valid; when the results of the 7 CRCs 1 through 7 are all valid, perform step 513; if there is a mismatch between the results of the 7 CRCs 1 through 7, go to step 516;
step 513, selecting a corresponding CRC value according to the priority and the effective mark;
step 514, searching a matching value table according to the selected CRC value to obtain a matching value and a KEY value as return values;
step 515, matching and comparing the KEY value of the entry with the KEY value returned by the reading table, and judging whether the entry is matched with the KEY value; if the KEY value of the entry matches the KEY value returned by the read table, go to step 517; if the KEY value of the entry does not match the KEY value returned by the read table, go to step 516;
step 516, processing according to a preset rule;
and 517, processing according to the result returned by the reading table.
It will be understood by those skilled in the art that all or part of the steps of the above methods may be implemented by a program instructing associated hardware (e.g., a processor) to perform the steps, and the program may be stored in a computer readable storage medium, such as a read only memory, a magnetic or optical disk, and the like. Alternatively, all or part of the steps of the above embodiments may be implemented using one or more integrated circuits. Accordingly, each module/unit in the above embodiments may be implemented in hardware, for example, by an integrated circuit to implement its corresponding function, or in software, for example, by a processor executing a program/instruction stored in a memory to implement its corresponding function. The present invention is not limited to any specific form of combination of hardware and software.
Although the embodiments of the present invention have been described above, the above description is only for the convenience of understanding the present invention, and is not intended to limit the present invention. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (12)

1. A method for implementing table lookup processing, comprising:
determining whether the entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to the KEY value of the entry;
when the entry exists, determining the address of the matching table according to the calculation result of the CRC polynomial;
determining the off-chip HasH table look-up address according to the returned result after the determined matching table address is used for look-up of the matching table;
performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, and performing table lookup according to whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup;
wherein the determining whether an entry exists comprises:
performing a first preset time of the CRC polynomial calculation on the KEY value of the entry; using the calculation result of the 0 th CRC polynomial as the address of the matching table to perform table lookup; when the result returned by the matching table lookup is matched with the calculation result of other CRC polynomials except the 0 th CRC, determining that the entry exists; wherein, the 0 th is the smallest one of the sequence numbers.
2. The method of claim 1, wherein performing a table lookup process according to whether the KEY value of the entry and the KEY value returned by the hash table lookup are consistent comprises:
the KEY value of the entry is consistent with the KEY value returned by the hash table lookup, and the entry is returned; and determining that the item is not hit when the KEY value of the item is inconsistent with the KEY value returned by the hash table lookup.
3. The method of claim 1, further comprising:
and when the result returned by the matching table lookup is not matched with the calculation results of other CRC polynomials except the 0 th CRC, the item is uploaded to a Central Processing Unit (CPU) for processing, or the item is processed according to a preset rule.
4. The method of any of claims 1-3, wherein prior to determining whether an entry exists via Cyclic Redundancy Check (CRC) polynomial computation, the method further comprises:
setting a second preset number MASK according to the entry related to the service;
for each item, selecting a MASK of a corresponding type according to a message analysis result, a service step and/or an application mode;
filtering invalid KEY values in the entries according to the selected MASK;
wherein, the message analysis result comprises the message type.
5. The method of any of claims 1-3, wherein prior to determining whether an entry exists via Cyclic Redundancy Check (CRC) polynomial computation, the method further comprises:
configuring a third preset bloom filter table;
performing CRC calculation on the KEY value of the entry to obtain a CRC result;
searching all bloom filter tables by using the CRC result to obtain a filter table result;
judging whether the entry exists according to the result of the filter table;
and when determining that the entry exists, continuing to look up the table, and when determining that the entry does not exist, stopping looking up the table.
6. The method of claim 5, wherein configuring a third preset number of bloom filter tables comprises:
and configuring a third preset number of bloom filter tables according to the number of the entries supporting the conflict.
7. An apparatus for implementing table lookup processing, comprising: the device comprises a first judgment unit, a matching table address unit, a hash address unit and a table look-up processing unit; wherein the content of the first and second substances,
the first judging unit is used for: determining whether the entry exists through Cyclic Redundancy Check (CRC) polynomial calculation according to the KEY value of the entry;
the match table address unit is to: when the entry exists, determining the address of the matching table according to the calculation result of the CRC polynomial;
the hash address unit is to: determining the off-chip HasH table look-up address according to the returned result after the determined matching table address is used for look-up of the matching table;
the table look-up processing unit is used for: performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, and performing table lookup according to whether the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup;
the first judging unit is specifically configured to: performing a first preset time of the CRC polynomial calculation on the KEY value of the entry; using the calculation result of the 0 th CRC polynomial as the address of the matching table to perform table lookup; when the result returned by the matching table lookup is matched with the calculation result of other CRC polynomials except the 0 th CRC, determining that the entry exists; wherein, the 0 th is the smallest one of the sequence numbers.
8. The apparatus of claim 7, wherein the table lookup processing unit is specifically configured to:
performing table lookup according to the determined off-chip HASH table lookup address to obtain a KEY value returned by the Hash table lookup, wherein the KEY value of the entry is consistent with the KEY value returned by the Hash table lookup, and returning the entry; and determining that the item is not hit when the KEY value of the item is inconsistent with the KEY value returned by the hash table lookup.
9. The apparatus of claim 7, wherein the lookup processing unit is further configured to:
and when the result returned by the matching table lookup is not matched with the calculation results of other CRC polynomials except the 0 th CRC, the item is uploaded to a Central Processing Unit (CPU) for processing, or the item is processed according to a preset rule.
10. The device according to any one of claims 7 to 9, further comprising a setting mask unit, a mask selecting unit and a filtering unit; wherein the content of the first and second substances,
a set mask unit to: setting a second preset number MASK according to the entry related to the service;
the mask selection unit is to: for each item, selecting a MASK of a corresponding type according to a message analysis result, a service step and/or an application mode;
the filtering unit is used for: filtering invalid KEY values in the entries according to the selected MASK;
wherein, the message analysis result comprises the message type.
11. The device according to any one of claims 7 to 9, wherein the device further comprises a configuration unit, a second calculation unit, a second table look-up unit, a second determination unit and a second processing unit; wherein the content of the first and second substances,
the configuration unit is used for: configuring a third preset bloom filter table;
the second calculation unit is configured to: performing CRC calculation on the KEY value of the entry to obtain a CRC result;
the second table look-up unit is used for: searching all bloom filter tables by using the CRC result to obtain a filter table result;
the second determination unit is configured to: judging whether the entry exists according to the result of the filter table;
the second processing unit is used for: and when determining that the entry exists, continuing to look up the table, and when determining that the entry does not exist, stopping looking up the table.
12. The apparatus according to claim 11, wherein the configuration unit is specifically configured to:
and configuring a third preset number of bloom filter tables according to the number of the entries supporting the conflict.
CN201710210525.1A 2017-03-31 2017-03-31 Method and device for realizing table look-up processing Active CN108664518B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710210525.1A CN108664518B (en) 2017-03-31 2017-03-31 Method and device for realizing table look-up processing
PCT/CN2018/079946 WO2018177184A1 (en) 2017-03-31 2018-03-22 Method and device for implementing table lookup processing, apparatus, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710210525.1A CN108664518B (en) 2017-03-31 2017-03-31 Method and device for realizing table look-up processing

Publications (2)

Publication Number Publication Date
CN108664518A CN108664518A (en) 2018-10-16
CN108664518B true CN108664518B (en) 2021-12-07

Family

ID=63674222

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710210525.1A Active CN108664518B (en) 2017-03-31 2017-03-31 Method and device for realizing table look-up processing

Country Status (2)

Country Link
CN (1) CN108664518B (en)
WO (1) WO2018177184A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114584482B (en) * 2022-02-14 2023-09-08 阿里巴巴(中国)有限公司 Method, device and network card for storing detection data based on memory
CN117411738B (en) * 2023-12-15 2024-03-08 格创通信(浙江)有限公司 Multicast replication method, device, electronic equipment and storage medium
CN117478626B (en) * 2023-12-27 2024-04-05 天津光电聚能通信股份有限公司 Quick matching searching system, method, equipment and medium based on group connection cache

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1489336A (en) * 2003-01-27 2004-04-14 四川南山之桥微电子有限公司 Network filtering processor
CN101350788A (en) * 2008-08-25 2009-01-21 中兴通讯股份有限公司 Method for mixed loop-up table of network processor inside and outside
CN101540723A (en) * 2009-04-20 2009-09-23 杭州华三通信技术有限公司 Flow stream searching method and device
CN102682116A (en) * 2012-05-14 2012-09-19 中兴通讯股份有限公司 Method and device for processing table items based on Hash table
CN102761394A (en) * 2012-07-05 2012-10-31 中兴通讯股份有限公司 Method and device for processing data
CN103001878A (en) * 2012-11-26 2013-03-27 中兴通讯股份有限公司 Determination method and device for media access control (MAC) address Hash collision
CN103918032A (en) * 2011-10-31 2014-07-09 华为技术有限公司 A method and apparatus for network table lookups

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030223417A1 (en) * 2002-06-04 2003-12-04 Masashi Higashida Method of processing data packets
US7904460B2 (en) * 2008-04-23 2011-03-08 Microsoft Corporation Determining computer information from processor properties
CN104866502B (en) * 2014-02-25 2020-10-13 深圳市中兴微电子技术有限公司 Data matching method and device
CN105376159A (en) * 2014-08-25 2016-03-02 深圳市中兴微电子技术有限公司 Packet processing and forwarding device and method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1489336A (en) * 2003-01-27 2004-04-14 四川南山之桥微电子有限公司 Network filtering processor
CN1238996C (en) * 2003-01-27 2006-01-25 四川南山之桥微电子有限公司 Network filtering processor
CN101350788A (en) * 2008-08-25 2009-01-21 中兴通讯股份有限公司 Method for mixed loop-up table of network processor inside and outside
CN101540723A (en) * 2009-04-20 2009-09-23 杭州华三通信技术有限公司 Flow stream searching method and device
CN103918032A (en) * 2011-10-31 2014-07-09 华为技术有限公司 A method and apparatus for network table lookups
CN102682116A (en) * 2012-05-14 2012-09-19 中兴通讯股份有限公司 Method and device for processing table items based on Hash table
CN102761394A (en) * 2012-07-05 2012-10-31 中兴通讯股份有限公司 Method and device for processing data
CN103001878A (en) * 2012-11-26 2013-03-27 中兴通讯股份有限公司 Determination method and device for media access control (MAC) address Hash collision

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于快速搜索树的路由查表算法;谭兴晔;《计算机应用研究》;20050710;全文 *

Also Published As

Publication number Publication date
WO2018177184A1 (en) 2018-10-04
CN108664518A (en) 2018-10-16

Similar Documents

Publication Publication Date Title
US10503716B2 (en) Systems and methods for generating bit matrices for hash functions using fast filtering
US7644080B2 (en) Method and apparatus for managing multiple data flows in a content search system
US7539032B2 (en) Regular expression searching of packet contents using dedicated search circuits
US7529746B2 (en) Search circuit having individually selectable search engines
US7953077B2 (en) Network processor with single interface supporting tree search engine and CAM
US7624105B2 (en) Search engine having multiple co-processors for performing inexact pattern search operations
US7539031B2 (en) Inexact pattern searching using bitmap contained in a bitcheck command
US9223720B2 (en) Systems and methods for rapidly generating suitable pairs of hash functions
US20190266193A1 (en) Data processing method for bloom filter, and bloom filter
US9811777B2 (en) Rule matching method and apparatus for deep packet inspection
US20110016142A1 (en) Method and apparatus for creating pattern matching state machine and identifying pattern
CN108664518B (en) Method and device for realizing table look-up processing
JP2004229163A (en) Device and method for retrieving fixed length data, computer program, and computer readable recording medium
US20060248079A1 (en) Method and apparatus for finding a perfect hash function and making minimal hash table for a given set of keys
US10776427B2 (en) Efficient conditional state mapping in a pattern matching automaton
US9852807B1 (en) Content addressable memory in an emulation system
US20160132559A1 (en) Tcam-based table query processing method and apparatus
EP3198476A1 (en) Efficient pattern matching
US10846598B2 (en) Pattern matching
CN103368852A (en) Method and system for processing hash conflict
CN111177198B (en) Content searching method for chip
WO2019062067A1 (en) User interface unit test method and apparatus, readable storage medium and device
WO2024016863A1 (en) Rule lookup method and apparatus, device and computer-readable storage medium
CN111506670B (en) Data processing method, device and equipment
US20220385593A1 (en) Hardware-implemented tables and methods of using the same for classification and collision resolution of data packets

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant