Hash table, method, computer device and medium for flow table matching

By using the disabled stream sequence number set in the hash table to detect the effectiveness of the hash bucket, the problem of excessive hash table resource occupation and hash conflict in large-scale data transmission is solved, and resource conservation and performance improvement is achieved.

CN118631735BActive Publication Date: 2024-11-01SHENZHEN XINGYUN ZHILIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411098131.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-01
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

In network nodes such as data centers, with the increase in large-scale data stream transmission, the number of table entries in the hash table surges, resulting in excessive storage resources occupied, reducing data transmission performance and increasing costs, and hash conflicts are difficult control.

Method used

By introducing a set of disabled stream number in the hash table, the stream number domain segment is used to detect whether the disabled stream number is included, thereby determining the effectiveness of the hash bucket, avoiding the independent data valid identification domain segment, saving storage space and reducing hash conflicts .

Benefits of technology

It effectively saves the resource usage of the hash table, reduces system resource overhead, adapts to large-scale data transmission services, reduces hash conflicts, and improves data transmission performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118631735B_ABST
    Figure CN118631735B_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer technology and provides a hash table, method, computer device and medium for flow table matching. The hash table includes: at least one hash bucket, wherein each of the at least one hash bucket includes a hash value field and a flow sequence number field, the hash value field is used to store a hash value for hash matching, and the flow sequence number field is used to store a flow sequence number for flow table indexing; wherein at least one flow sequence number is pre-identified as a disabled flow sequence number set, and the at least one flow sequence number corresponds to at least one identifier one by one, and by detecting whether the flow sequence number field of each of the at least one hash bucket includes a flow sequence number belonging to the disabled flow sequence number set, it is determined whether the at least one hash bucket has a corresponding identifier. In this way, the table entry resource occupation is saved and the system resource overhead is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a hash table, method, computer device and medium for flow table matching. Background Art

[0002] With the development of network communications, big data centers, artificial intelligence and other technologies, network nodes such as data centers need to process large-scale data stream transmission, such as the number of data streams reaching the order of millions or tens of millions. For this reason, it is necessary to store important information for message processing on the chip in the form of table entries, such as for message parsing, feature value matching, message editing and message forwarding. As the scale of data transmission increases, the number of data streams and the number of table entries also increase significantly, thus occupying a large amount of related storage resources, which is not conducive to reducing costs and improving overall data transmission performance.

[0003] To this end, the present application provides a hash table, method, computer device and medium for flow table matching, which are used to address the technical difficulties in the prior art. Summary of the invention

[0004] In the first aspect, the present application provides a hash table for flow table matching. The hash table includes: at least one hash bucket, wherein each of the at least one hash bucket includes a hash value field and a flow sequence number field, the hash value field is used to store a hash value for hash matching, and the flow sequence number field is used to store a flow sequence number for flow table indexing; wherein at least one flow sequence number is pre-identified as a disabled flow sequence number set, and the at least one flow sequence number corresponds one-to-one with at least one identifier, and whether the at least one hash bucket has a corresponding identifier is determined by detecting whether the flow sequence number field of each of the at least one hash bucket includes a flow sequence number belonging to the disabled flow sequence number set.

[0005] Through the first aspect of the present application, by optimizing the data structure of the hash table, by predetermining the flow number in the disabled flow number set corresponding to the identifier, and by detecting whether the flow number field of each of the at least one hash bucket includes the flow number belonging to the disabled flow number set, it is determined whether the at least one hash bucket has the corresponding identifier, thereby saving the storage space required in the hash table to separately provide the identifier field corresponding to these identifiers, effectively reducing the overall resources occupied by the hash table, saving table item resource occupation and saving system resource overhead, which is conducive to adapting to large-scale data transmission services and also conducive to reducing hash conflicts.

[0006] In a possible implementation manner of the first aspect of the present application, the at least one stream sequence number includes an all-zero stream sequence number, and the identifier corresponding to the all-zero stream sequence number is a hash bucket data valid identifier.

[0007] In a possible implementation of the first aspect of the present application, the first hash bucket is any hash bucket of the at least one hash bucket, and when the flow sequence number stored in the flow sequence number field of the first hash bucket is the all-zero flow sequence number, the first hash bucket is determined to have invalid data, and when the flow sequence number stored in the flow sequence number field of the first hash bucket is not the all-zero flow sequence number, the first hash bucket is determined to have valid data.

[0008] In a possible implementation manner of the first aspect of the present application, when the flow table entry corresponding to the first hash bucket is deleted, the flow sequence number stored in the flow sequence number field of the first hash bucket is the all-zero flow sequence number.

[0009] In a possible implementation manner of the first aspect of the present application, the at least one hash bucket does not include a data validity identification field segment.

[0010] In a possible implementation of the first aspect of the present application, the hash table is associated with at least one hash table identification field segment, the at least one hash table identification field segment includes a hash bucket data valid identification field segment, the at least one identification corresponds one-to-one to the at least one hash table identification field segment, and by determining whether the at least one hash bucket has the at least one identification, detection based on the at least one hash table identification field segment is equivalently implemented.

[0011] In a possible implementation manner of the first aspect of the present application, the set of disabled flow sequence numbers is a plurality of discrete flow sequence numbers or a continuous range of flow sequence numbers.

[0012] In a possible implementation of the first aspect of the present application, the hash table is associated with a flow number disable mode register and a flow number disable mode register group, the flow number disable mode register is used to indicate that the disabled flow number set is the multiple discrete flow numbers or the continuous flow number range, the flow number disable mode register group is used to store the disabled flow number set, and the flow number disable mode register and the flow number disable mode register group are used to detect whether the flow number field segments of each of the at least one hash bucket include flow numbers belonging to the disabled flow number set.

[0013] In a possible implementation manner of the first aspect of the present application, the hash table is used for data stream transmission based on a first communication transmission protocol, and the at least one identifier is determined based on the first communication transmission protocol.

[0014] In the second aspect, the present application provides a method for flow table matching. The method for flow table matching includes: based on the hash value field of each of at least one hash bucket included in the hash table, performing hash matching to determine the matching hash bucket, wherein each of the at least one hash bucket includes a flow sequence number field, and the flow sequence number field is used to store the flow sequence number used for the flow table index; based on the flow sequence number field of the matching hash bucket, performing flow table matching to determine the matching flow table entry, wherein at least one flow sequence number is pre-identified as a disabled flow sequence number set, and the at least one flow sequence number corresponds to at least one identifier one-to-one, and the method for flow table matching also includes: determining whether the at least one hash bucket has a corresponding identifier by detecting whether the flow sequence number field of each of the at least one hash bucket includes a flow sequence number belonging to the disabled flow sequence number set.

[0015] Through the second aspect of the present application, by optimizing the data structure of the hash table, by predetermining the flow number in the disabled flow number set corresponding to the identifier, and by detecting whether the flow number field of each of the at least one hash bucket includes the flow number belonging to the disabled flow number set, it is determined whether the at least one hash bucket has the corresponding identifier, thereby saving the storage space required in the hash table to separately provide the identifier field corresponding to these identifiers, effectively reducing the overall resources occupied by the hash table, saving table item resource occupation and saving system resource overhead, which is conducive to adapting to large-scale data transmission services and also conducive to reducing hash conflicts.

[0016] In a possible implementation manner of the second aspect of the present application, the at least one stream sequence number includes an all-zero stream sequence number, and the identifier corresponding to the all-zero stream sequence number is a hash bucket data valid identifier.

[0017] In a possible implementation of the second aspect of the present application, the first hash bucket is any hash bucket of the at least one hash bucket, and when the flow sequence number stored in the flow sequence number field of the first hash bucket is the all-zero flow sequence number, the first hash bucket is determined to have invalid data, and when the flow sequence number stored in the flow sequence number field of the first hash bucket is not the all-zero flow sequence number, the first hash bucket is determined to have valid data.

[0018] In a possible implementation manner of the second aspect of the present application, when the flow table entry corresponding to the first hash bucket is deleted, the flow sequence number stored in the flow sequence number field of the first hash bucket is the all-zero flow sequence number.

[0019] In a possible implementation manner of the second aspect of the present application, the at least one hash bucket does not include a data validity identification field segment.

[0020] In a possible implementation of the second aspect of the present application, the hash table is associated with at least one hash table identification field segment, the at least one hash table identification field segment includes a hash bucket data valid identification field segment, the at least one identification corresponds one-to-one to the at least one hash table identification field segment, and by determining whether the at least one hash bucket has the at least one identification, detection based on the at least one hash table identification field segment is equivalently implemented.

[0021] In a possible implementation manner of the second aspect of the present application, the set of disabled flow sequence numbers is a plurality of discrete flow sequence numbers or a continuous flow sequence number range.

[0022] In a possible implementation of the second aspect of the present application, the hash table is associated with a flow number disable mode register and a flow number disable mode register group, the flow number disable mode register is used to indicate that the disabled flow number set is the multiple discrete flow numbers or the continuous flow number range, the flow number disable mode register group is used to store the disabled flow number set, and the method for flow table matching also includes: by reading the flow number disable mode register and the flow number disable mode register group, thereby detecting whether the flow number field segment of each of the at least one hash buckets includes a flow number belonging to the disabled flow number set.

[0023] In a possible implementation manner of the second aspect of the present application, the hash table is used for data stream transmission based on a first communication transmission protocol, and the at least one identifier is determined based on the first communication transmission protocol.

[0024] In a third aspect, an embodiment of the present application further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method according to any one of the implementation modes of any of the above aspects when executing the computer program.

[0025] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, which, when executed on a computer device, enable the computer device to execute a method according to any one of the implementation modes of any of the above aspects.

[0026] In a fifth aspect, an embodiment of the present application further provides a computer program product, which includes instructions stored on a computer-readable storage medium, and when the instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0028] Figure 1 A schematic diagram of a hash table for flow table matching provided in an embodiment of the present application;

[0029] Figure 2 A flowchart of a method for flow table matching provided in an embodiment of the present application;

[0030] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] The embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0032] It should be understood that, in the description of this application, "at least one" means one or more, and "a plurality of" means two or more. In addition, unless otherwise specified, the words "first", "second", etc. are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.

[0033] Figure 1 A schematic diagram of a hash table 100 for flow table matching provided in an embodiment of the present application. Figure 1 As shown, the hash table 100 includes at least one hash bucket. Figure 1 exemplarily shows a hash bucket A110, a hash bucket B120 and a hash bucket C130. It should be understood that Figure 1 The three hash buckets shown in are only exemplary, and the hash table 100 may include any number of hash buckets. Wherein, each of the at least one hash bucket includes a hash value field and a flow sequence number field, the hash value field is used to store a hash value for hash matching, and the flow sequence number field is used to store a flow sequence number for flow table indexing. Figure 1 exemplarily shows that hash bucket A110 includes hash value field A112 and flow sequence number field A114, hash bucket B120 includes hash value field B122 and flow sequence number field B124, and hash bucket C130 includes hash value field C132 and flow sequence number field C134. At least one flow sequence number is pre-identified as a disabled flow sequence number set 150. Figure 1exemplarily shows that the disabled flow sequence number set 150 includes flow sequence number A152. The at least one flow sequence number corresponds to at least one identifier. By detecting whether the flow sequence number field of each of the at least one hash bucket includes a flow sequence number belonging to the disabled flow sequence number set 150, it is determined whether the at least one hash bucket has a corresponding identifier. Figure 1 , the structure of hash bucket A110 includes hash value field A112 and flow sequence number field A114, wherein the flow sequence number stored in flow sequence number field A114 is flow sequence number A152. The structure of hash bucket B120 includes hash value field B122 and flow sequence number field B124, wherein the flow sequence number stored in flow sequence number field B124 is flow sequence number B160. The structure of hash bucket C130 includes hash value field C132 and flow sequence number field C134, wherein the flow sequence number stored in flow sequence number field C134 is flow sequence number C162.

[0034] Continue reading Figure 1 , Figure 1 The hash table 100 shown can be applied to application scenarios such as network communications, big data centers, and artificial intelligence. In these application scenarios, data centers, high-performance servers, cloud computing platforms, and network nodes need to process large-scale data stream transmissions, such as data streams in the order of millions or tens of millions. Important information for message processing is generally stored on the chip in the form of table entries, such as for functions such as message parsing, feature value matching, message editing, and message forwarding. Among them, feature value matching means determining the corresponding table entry by matching the feature values ​​of the data frame, thereby performing corresponding operations such as editing and forwarding. In the feature value matching process of the data frame, two matching comparisons are required. The first matching comparison is a hash matching comparison. After the hash matching passes, a second matching comparison is performed, which is a flow table exact matching comparison. Among them, the data used for hash matching is the hash value, which is stored in the hash table 100, and the data used for flow table exact matching is the feature value, which is stored in the flow table. With Figure 1Taking the hash table 100 shown as an example, the hash table 100 includes at least one hash bucket, each of which includes a hash value field and a flow sequence number field. The hash value field is used to store a hash value for hash matching, and the flow sequence number field is used to store a flow sequence number for flow table indexing. In the hash table 100, multiple hash buckets, such as four hash buckets, can form a hash table entry, and each hash table entry has a certain number of hash buckets. In the hash matching comparison process, the hash table 100 is first queried to detect whether the hash value field of a certain hash bucket is matched. If the hash match passes, the flow sequence number stored in the flow sequence number field of the matching hash bucket is used as the index address of the flow table, so as to read the flow table and obtain the flow table content. Then, an accurate flow table match comparison is performed, and the characteristic value of the flow table item is used to match and compare with the characteristic value of the data frame, so as to determine the corresponding flow table item, and then the flow table item operation of the corresponding flow table item is performed, such as message parsing, message editing, message forwarding, etc. Because hash calculations such as hash calculations have the characteristic of compressing space, different feature values ​​may obtain the same hash value after hash calculation, that is, hash collision. In order to reduce hash collisions, the number of available hash values ​​should be much larger than the number of necessary hash values, that is, it is necessary to provide enough redundant hash values. The number of necessary hash values ​​corresponds to the number of entries in the flow table, also called the flow table depth, that is, how many flow table items are there in the flow table. The number of available hash values ​​corresponds to the number of hash buckets in the hash table 100. In application scenarios such as network communications, big data centers, and artificial intelligence, as the scale of data transmission increases, the number of entries in the flow table can reach the order of millions or tens of millions. Generally, the ratio between the number of hash buckets and the number of entries in the flow table is 1.5 to 1, 2 to 1 or a higher ratio. For example, assuming that the number of entries in the flow table is one million, the number of hash buckets is one and a half million. For another example, assuming that the number of entries in the flow table is ten million, the number of hash buckets is fifteen million. Therefore, as the number of entries in the flow table increases further, in order to control the hash collision within a certain range, the number of hash buckets needs to be much larger than the number of entries in the flow table. Therefore, when the ratio between the number of hash buckets and the number of entries in the flow table is determined, the hash table 100 occupies more resources overall, while the storage resources available for table entry storage on the chip are limited. Figure 1 The following further describes in detail how the hash table 100 for flow table matching provided in the embodiment of the present application can save table entry resource occupancy and system resource overhead by optimizing the data structure of the hash table 100.

[0035] Continue reading Figure 1As mentioned above, the hash table 100 includes at least one hash bucket, each of which includes a hash value field and a flow sequence number field, wherein the hash value field is used to store a hash value for hash matching, and the flow sequence number field is used to store a flow sequence number for flow table indexing. The hash table 100 and the associated flow table may need to be updated from time to time after initialization, such as adding new table entries or deleting existing table entries, or updating through flow table unloading, flow table aging, etc. For this reason, in combination with the above-mentioned hash matching comparison process and flow table exact matching comparison process, when adding a new flow table entry to the flow table, it is necessary to use an unoccupied hash bucket in the hash table 100 to store the corresponding flow sequence number field as a subsequent flow table index. After deleting an existing flow table entry, it is necessary to make the corresponding hash bucket in the hash table 100 indicate that the data in the hash bucket is invalid, so that the data in the hash bucket that should be deemed invalid will not be used to perform flow table indexing in the future, thereby possibly retrieving the deleted flow table entry. Therefore, the hash table 100 needs to provide a valid data flag or a corresponding invalid data flag to distinguish whether the data in the hash bucket in the hash table 100 is valid or invalid, so as to implement operations of adding new entries and deleting existing entries, and also implement flow table update operations such as flow table unloading and flow table aging. However, if the information of valid or invalid data in the hash bucket in the hash table 100 is provided by providing a separate flag field, at least 1 bit of flag field is required, such as a valid data flag field occupying 1 bit, and each hash bucket needs to occupy 1 bit of flag field. As mentioned above, the number of entries in the flow table can reach the order of millions or tens of millions. In order to reduce hash conflicts, the ratio between the number of hash buckets and the number of entries in the flow table is generally fixed and is generally 1.5 to 1, 2 to 1 or a higher ratio. Therefore, the size of the storage space occupied by the data valid identification field segment in the entire hash table 100 is 1 bit multiplied by the number of hash buckets, or it can be expressed as 1 bit multiplied by the number of entries in the flow table multiplied by the ratio between the number of hash buckets and the number of entries in the flow table. For example, assuming that the number of entries in the flow table is 1 million, the number of hash buckets is 1.5 million (the ratio is 1.5:1), and the size of the storage space occupied by the data valid identification field segment in the entire hash table 100 is 1.5 million bits. For another example, assuming that the number of entries in the flow table is 10 million, the number of hash buckets is 15 million (the ratio is 1.5:1), and the size of the storage space occupied by the data valid identification field segment in the entire hash table 100 is 15 million bits.It can be seen that if in the data structure of the hash table 100, the information of whether the data in the hash bucket of the hash table 100 is valid or invalid is provided by providing a separate identification field in each hash bucket, for example, a data valid identification field that occupies 1 bit, which means that considerable storage resources need to be occupied, resulting in an increase in the overall resources occupied by the hash table 100, and will compete for the limited storage resources that can be used for table item storage on the chip. However, assuming that a data valid identification field is provided separately for each hash bucket in the data structure of the hash table 100, for each hash bucket, the data valid identification field of the hash bucket only provides a data valid identification when reading or writing the hash bucket, which is used to indicate whether the data in the hash bucket is valid and thus provide a basis for read and write operations, etc. However, during the period when the hash bucket is not needed to be accessed, the data valid identification field of the hash bucket does not play a role. Moreover, unlike the hash value field used to store the hash value for hash matching, and unlike the flow sequence number field used to store the flow sequence number for flow table indexing, the data valid identification field of the hash bucket is only used to help implement table item operations such as adding new table item operations and deleting existing table item operations.

[0036] Continue reading Figure 1 , at least one flow sequence number is pre-identified as a disabled flow sequence number set 150. Figure 1 exemplarily shows that the disabled flow sequence number set 150 includes flow sequence number A152. The at least one flow sequence number corresponds to at least one identifier. By detecting whether the flow sequence number field of each of the at least one hash bucket includes a flow sequence number belonging to the disabled flow sequence number set 150, it is determined whether the at least one hash bucket has a corresponding identifier. Figure 1 It is exemplified in that the composition of hash bucket A110 includes hash value field A112 and flow sequence number field A114, wherein the flow sequence number stored in flow sequence number field A114 is flow sequence number A152. The composition of hash bucket B120 includes hash value field B122 and flow sequence number field B124, wherein the flow sequence number stored in flow sequence number field B124 is flow sequence number B160. The composition of hash bucket C130 includes hash value field C132 and flow sequence number field C134, wherein the flow sequence number stored in flow sequence number field C134 is flow sequence number C162. In this way, at least one flow sequence number is pre-identified as a disabled flow sequence number set 150, for example Figure 1 The flow sequence number A152 in the disabled flow sequence number set 150 shown in the figure can then be determined by detecting whether the flow sequence number field of each hash bucket is a flow sequence number in the disabled flow sequence number set 150, thereby equivalently determining whether each hash bucket has an identifier corresponding to a flow sequence number in the disabled flow sequence number set 150. Figure 1Taking the flow number A152 in the disabled flow number set 150 shown in FIG as an example, the flow number A152 may correspond to a data valid identifier, and the data valid identifier is used to provide information about whether the data in the hash bucket in the hash table 100 is valid or invalid. In this way, Figure 1 Each hash bucket in the hash table 100 shown does not need to provide information about whether the data in the hash bucket in the hash table 100 is valid or invalid by providing a separate identification field in each hash bucket, such as a data valid identification field that occupies 1 bit, but by detecting whether the flow sequence number field of each hash bucket is the flow sequence number A152 in the disabled flow sequence number set 150, it can be determined whether each hash bucket has a data valid identification. This means that each hash bucket in the hash table 100 does not need an additional data valid identification field, and by comparing the flow sequence number in the disabled flow sequence number set 150 with the flow sequence number field of each hash bucket, it is possible to effectively distinguish whether the data in each hash bucket in the hash table 100 is valid or invalid, and implement table entry operations such as adding new table entry operations and deleting existing table entry operations, thereby implementing flow table update operations such as flow table unloading and flow table aging. Therefore, since the data valid identification field is not needed, the storage resources originally required to provide the data valid identification field separately can be released. In addition, the optimization of the data structure of the hash table 100 does not require changing the existing structure of the hash buckets in the hash table 100, that is, it is not necessary to change the hash value field and the stream sequence number field of each hash bucket, but through the separately provided, for example Figure 1 The disabled flow sequence number set 150 shown realizes saving the table entry resource occupation and system resource overhead. In addition, in addition to the data valid identification or the relative data invalid identification (used to distinguish whether the data in the hash bucket in the hash table 100 is valid or invalid), other functional identifications can also be provided, and by predetermining the flow sequence numbers in the disabled flow sequence number set 150 corresponding to these functional identifications, these predetermined flow sequence numbers can be disabled as the sequence numbers of the data flow, so that these predetermined flow sequence numbers are equivalent to the identification signals reserved as functional identifications, thereby saving the storage space required for the hash table 100 to separately provide the identification domain segments corresponding to these functional identifications. This can effectively reduce the overall resources occupied by the hash table 100 in the application scenario where the number of entries in the flow table is large, that is, the number of hash buckets in the hash table 100 is large, which is conducive to more effective use of the limited storage resources on the chip that can be used for table entry storage. In some embodiments, these functional identifiers can be used to indicate whether the data in the hash bucket is valid or invalid, such as the above-mentioned valid data identifier or the relative invalid data identifier, and can also be used to assist in implementing flow table operations, direct memory access operations or specific operations, such as to meet communication protocols, security protocols, usage scenarios, user customization requirements, etc.

[0037] In conclusion, Figure 1 The hash table 100 shown for flow table matching optimizes the data structure of the hash table 100, predetermines the flow number in the disabled flow number set 150 corresponding to the identifier, and determines whether the at least one hash bucket has the corresponding identifier by detecting whether the flow number field of each of the at least one hash bucket includes the flow number belonging to the disabled flow number set 150, thereby saving the storage space required to separately provide the identifier field corresponding to these identifiers in the hash table 100, effectively reducing the overall resources occupied by the hash table 100, saving table item resource occupation and saving system resource overhead, which is conducive to adapting to large-scale data transmission services and also conducive to reducing hash conflicts.

[0038] In a possible implementation manner, the at least one stream sequence number includes an all-zero stream sequence number, and the identifier corresponding to the all-zero stream sequence number is a hash bucket data valid identifier. Figure 1 Taking the hash table 100 shown as an example, the flow sequence number A152 can be an all-zero flow sequence number. In this way, it is not necessary to provide information about whether the data in the hash bucket in the hash table 100 is valid or invalid by providing a separate identification field in each hash bucket, such as a data valid identification field that occupies 1 bit. Instead, by detecting whether the flow sequence field of each hash bucket is the flow sequence number A152 in the disabled flow sequence number set 150, that is, the all-zero flow sequence number, it is possible to determine whether each hash bucket has a data valid identification, that is, a hash bucket data valid identification. This means that each hash bucket in the hash table 100 does not need an additional data valid identification field. By comparing the flow sequence number in the disabled flow sequence number set 150 with the flow sequence field of each hash bucket, it is possible to effectively distinguish whether the data in each hash bucket in the hash table 100 is valid or invalid, and implement table entry operations such as adding new table entry operations and deleting existing table entry operations, thereby implementing flow table update operations such as flow table unloading and flow table aging.

[0039] In some embodiments, the first hash bucket is any hash bucket of the at least one hash bucket, and when the flow sequence number stored in the flow sequence number field of the first hash bucket is the all-zero flow sequence number, the first hash bucket is determined to have invalid data, and when the flow sequence number stored in the flow sequence number field of the first hash bucket is not the all-zero flow sequence number, the first hash bucket is determined to have valid data. In this way, it is not necessary to provide information about data validity or data invalidity in the hash buckets in the hash table 100 by providing a separate identification field in each hash bucket, such as a data valid identification field occupying 1 bit, but by detecting whether the flow sequence number field of each hash bucket is the flow sequence number A152 in the disabled flow sequence number set 150, that is, the all-zero flow sequence number, it is possible to determine whether each hash bucket has a data valid identification, that is, a hash bucket data valid identification. This means that each hash bucket in the hash table 100 may not need an additional data valid identification field. By comparing the flow number in the disabled flow number set 150 with the flow number field of each hash bucket, it is possible to effectively distinguish whether the data in each hash bucket in the hash table 100 is valid or invalid. In some examples, when the flow table entry corresponding to the first hash bucket is deleted, the flow number stored in the flow number field of the first hash bucket is the all-zero flow number. In this way, table entry operations such as adding new table entry operations and deleting existing table entry operations are implemented, thereby implementing flow table update operations such as flow table unloading and flow table aging.

[0040] In some embodiments, at least one of the hash buckets does not include a data valid identification field. In this way, since the data valid identification field is not needed, the storage resources originally required to provide the data valid identification field alone can be released, and the optimization of the data structure of the hash table 100 does not require changes to the existing structure of the hash buckets in the hash table 100, that is, there is no need to change the hash value field and the flow sequence number field of each hash bucket. In application scenarios where the number of entries in the flow table is large, that is, the number of hash buckets in the hash table 100 is large, the overall resources occupied by the hash table 100 can be effectively reduced, which is conducive to more efficient use of the limited storage resources on the chip that can be used for table item storage.

[0041] In one possible implementation, the hash table 100 is associated with at least one hash table 100 identification field segment, and the at least one hash table 100 identification field segment includes a hash bucket data valid identification field segment, and the at least one identification corresponds one-to-one to the at least one hash table 100 identification field segment, and by determining whether the at least one hash bucket has the at least one identification, detection based on the at least one hash table 100 identification field segment is equivalently achieved. In this way, in addition to the data valid identifier or the relative data invalid identifier (used to distinguish whether the data in the hash bucket in the hash table 100 is valid or invalid), other functional identifiers can also be provided, and by predetermining the flow numbers in the disabled flow number set 150 corresponding to these functional identifiers, these predetermined flow numbers can be disabled as the sequence numbers of the data flows, so that these predetermined flow numbers are equivalent to being retained as identification signals of functional identifiers, thereby saving the storage space required to separately provide the identification domain segments corresponding to these functional identifiers in the hash table 100. This can effectively reduce the overall resources occupied by the hash table 100 in application scenarios where the number of entries in the flow table is large, that is, the number of hash buckets in the hash table 100 is large, which is conducive to more efficient use of the limited storage resources on the chip that can be used for table item storage.

[0042] In a possible implementation, the disabled flow sequence number set 150 is a plurality of discrete flow sequence numbers or a continuous flow sequence number range. In this way, by optimizing the data structure of the hash table 100, by predetermining the flow sequence numbers in the disabled flow sequence number set 150 corresponding to the identifier, by detecting whether the flow sequence number field of each of the at least one hash bucket includes the flow sequence number belonging to the disabled flow sequence number set 150, it is determined whether the at least one hash bucket has the corresponding identifier, thereby saving the storage space required to separately provide the identifier field corresponding to these identifiers in the hash table 100, effectively reducing the overall resources occupied by the hash table 100, saving the table item resource occupation and saving the system resource overhead, which is conducive to adapting to large-scale data transmission services and also conducive to reducing hash conflicts.

[0043] In some embodiments, the hash table 100 is associated with a stream number disable mode register and a stream number disable mode register group, the stream number disable mode register is used to indicate that the disabled stream number set 150 is the multiple discrete stream numbers or the continuous stream number range, the stream number disable mode register group is used to store the disabled stream number set 150, and the stream number disable mode register and the stream number disable mode register group are used to detect whether the stream number field of each of the at least one hash bucket includes a stream number belonging to the disabled stream number set 150. In this way, by using the stream number disable mode register and the stream number disable mode register group, it is achieved to save table entry resource occupancy and system resource overhead, which is conducive to adapting to large-scale data transmission services and also conducive to reducing hash conflicts.

[0044] In a possible implementation, the hash table 100 is used for data stream transmission based on a first communication transmission protocol, and the at least one identifier is determined based on the first communication transmission protocol. In this way, the requirements of adapting to various communication transmission protocols are achieved, which is conducive to customized input and output.

[0045] Figure 2 A flow chart of a method for flow table matching provided in an embodiment of the present application. Figure 2 As shown, the method for flow table matching includes the following steps.

[0046] Step S210: Based on the hash value fields of at least one hash bucket included in the hash table, hash matching is performed to determine a matching hash bucket, wherein the at least one hash bucket each includes a flow sequence number field, and the flow sequence number field is used to store the flow sequence number used for the flow table index.

[0047] Step S220: Based on the flow sequence number field of the matching hash bucket, flow table matching is performed to determine a matching flow table entry.

[0048] See also Figure 2 , at least one flow sequence number is pre-identified as a disabled flow sequence number set, and the at least one flow sequence number corresponds one-to-one to at least one identifier. The method for flow table matching also includes: determining whether the at least one hash bucket has a corresponding identifier by detecting whether the flow sequence number field of each of the at least one hash bucket includes a flow sequence number belonging to the disabled flow sequence number set.

[0049] Figure 2The method for flow table matching shown optimizes the data structure of the hash table, predetermines the flow number in the disabled flow number set corresponding to the identifier, and determines whether the at least one hash bucket has the corresponding identifier by detecting whether the flow number field of each of the at least one hash bucket includes the flow number belonging to the disabled flow number set, thereby saving the storage space required in the hash table to separately provide the identifier fields corresponding to these identifiers, effectively reducing the overall resources occupied by the hash table, saving table item resource occupation and saving system resource overhead, which is conducive to adapting to large-scale data transmission services and also conducive to reducing hash conflicts.

[0050] In a possible implementation, the at least one flow sequence number includes an all-zero flow sequence number, and the identifier corresponding to the all-zero flow sequence number is a hash bucket data valid identifier. In this way, it is not necessary to provide information about the validity or invalidity of the data in the hash bucket in the hash table by providing a separate identifier field in each hash bucket, such as a data valid identifier field that occupies 1 bit, but by detecting whether the flow sequence number field of each hash bucket is a flow sequence number in a disabled flow sequence number set, that is, the all-zero flow sequence number, it is possible to determine whether each hash bucket has a data valid identifier, that is, a hash bucket data valid identifier. This means that each hash bucket in the hash table may not require an additional data valid identifier field, and by comparing the flow sequence number in the disabled flow sequence number set with the flow sequence number field of each hash bucket, it is possible to effectively distinguish whether the data in each hash bucket in the hash table is valid or invalid, thereby realizing table entry operations such as adding new table entry operations and deleting existing table entry operations, and thus realizing flow table update operations such as flow table unloading and flow table aging.

[0051] In some embodiments, the first hash bucket is any hash bucket of the at least one hash bucket, and when the flow sequence number stored in the flow sequence number field of the first hash bucket is the all-zero flow sequence number, the first hash bucket is determined to have invalid data, and when the flow sequence number stored in the flow sequence number field of the first hash bucket is not the all-zero flow sequence number, the first hash bucket is determined to have valid data. In this way, it is not necessary to provide information about the validity or invalidity of data in the hash bucket in the hash table by providing a separate identification field in each hash bucket, such as a data valid identification field occupying 1 bit, but by detecting whether the flow sequence number field of each hash bucket is a flow sequence number in a disabled flow sequence number set, that is, the all-zero flow sequence number, it is possible to determine whether each hash bucket has a data valid identification, that is, a hash bucket data valid identification. This means that each hash bucket in the hash table may not need an additional data valid identification field, and the flow sequence number in the disabled flow sequence number set is compared with the flow sequence number field of each hash bucket to effectively distinguish whether the data in each hash bucket in the hash table is valid or invalid. In some examples, when the flow table entry corresponding to the first hash bucket is deleted, the flow sequence number stored in the flow sequence number field of the first hash bucket is the all-zero flow sequence number. In this way, table entry operations such as adding new table entry operations and deleting existing table entry operations are implemented, thereby implementing flow table update operations such as flow table unloading and flow table aging.

[0052] In some embodiments, at least one of the hash buckets does not include a data valid identification field. In this way, because the data valid identification field is not needed, the storage resources originally required to provide the data valid identification field alone can be released, and the optimization of the data structure of the hash table does not require changes to the existing structure of the hash buckets in the hash table, that is, there is no need to change the hash value field and the flow sequence number field of each hash bucket. In application scenarios where the number of entries in the flow table is large, that is, the number of hash buckets in the hash table is large, the overall resources occupied by the hash table can be effectively reduced, which is conducive to more efficient use of the limited storage resources on the chip that can be used for table item storage.

[0053] In a possible implementation, the hash table is associated with at least one hash table identification field segment, the at least one hash table identification field segment includes a hash bucket data valid identification field segment, the at least one identification corresponds to the at least one hash table identification field segment one by one, and by determining whether the at least one hash bucket has the at least one identification, detection based on the at least one hash table identification field segment is equivalently realized. In this way, in addition to the data valid identification or the relative data invalid identification (used to distinguish whether the data in the hash bucket in the hash table is valid or invalid), other functional identifications can also be provided, and by predetermining the flow sequence numbers in the disabled flow sequence number set corresponding to these functional identifications, these predetermined flow sequence numbers can be disabled as the sequence numbers of the data flow, so that these predetermined flow sequence numbers are equivalent to being reserved as identification signals of functional identifications, thereby saving the storage space required for the hash table to separately provide the identification fields corresponding to these functional identifications. This can effectively reduce the overall resources occupied by the hash table in application scenarios where the number of entries in the flow table is large, that is, the number of hash buckets in the hash table is large, and is conducive to more efficient use of the limited storage resources on the chip that can be used for table item storage.

[0054] In a possible implementation, the disabled flow sequence number set is a plurality of discrete flow sequence numbers or a continuous flow sequence number range. In this way, by optimizing the data structure of the hash table, by predetermining the flow sequence numbers in the disabled flow sequence number set corresponding to the identifier, by detecting whether the flow sequence number field of each of the at least one hash bucket includes the flow sequence number belonging to the disabled flow sequence number set, it is determined whether the at least one hash bucket has the corresponding identifier, thereby saving the storage space required in the hash table to separately provide the identifier field corresponding to these identifiers, effectively reducing the overall resources occupied by the hash table, saving the table item resource occupation and saving the system resource overhead, which is conducive to adapting to large-scale data transmission services and also conducive to reducing hash conflicts.

[0055] In some embodiments, the hash table is associated with a flow number disable mode register and a flow number disable mode register group, the flow number disable mode register is used to indicate that the disabled flow number set is the multiple discrete flow numbers or the continuous flow number range, the flow number disable mode register group is used to store the disabled flow number set, and the method for flow table matching also includes: by reading the flow number disable mode register and the flow number disable mode register group, thereby detecting whether the flow number field segment of each of the at least one hash bucket includes a flow number belonging to the disabled flow number set. In this way, by using the flow number disable mode register and the flow number disable mode register group, it is achieved to save table entry resource occupancy and system resource overhead, which is conducive to adapting to large-scale data transmission services and also conducive to reducing hash conflicts.

[0056] In a possible implementation, the hash table is used for data stream transmission based on a first communication transmission protocol, and the at least one identifier is determined based on the first communication transmission protocol. In this way, the requirements of adapting to various communication transmission protocols are achieved, which is conducive to customized input and output.

[0057] Figure 3 3 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application, and the computing device 300 includes: one or more processors 310, a communication interface 320 and a memory 330. The processor 310, the communication interface 320 and the memory 330 are interconnected via a bus 340. Optionally, the computing device 300 may also include an input / output interface 350, and the input / output interface 350 is connected to an input / output device for receiving parameters set by a user, etc. The computing device 300 can be used to implement some or all of the functions of the device embodiment or system embodiment in the above-mentioned embodiment of the present application; the processor 310 can also be used to implement some or all of the operating steps of the method embodiment in the above-mentioned embodiment of the present application. For example, the specific implementation of the various operations performed by the computing device 300 can refer to the specific details in the above-mentioned embodiments, such as the processor 310 is used to perform some or all of the steps in the above-mentioned method embodiment or some or all of the operations in the above-mentioned method embodiment. For another example, in an embodiment of the present application, the computing device 300 may be used to implement part or all of the functions of one or more components in the above-mentioned apparatus embodiment. In addition, the communication interface 320 may be specifically used to perform the communication functions necessary to implement the functions of these apparatuses and components, and the processor 310 may be specifically used to perform the processing functions necessary to implement the functions of these apparatuses and components.

[0058] It should be understood that Figure 3 The computing device 300 may include one or more processors 310, and the multiple processors 310 may provide processing capabilities in a parallel connection mode, a serial connection mode, a serial-parallel connection mode, or any connection mode, or the multiple processors 310 may form a processor sequence or a processor array, or the multiple processors 310 may be divided into a main processor and an auxiliary processor, or the multiple processors 310 may have different architectures such as a heterogeneous computing architecture. In addition, Figure 3 The computing device 300 shown in the figure, and the related structural description and functional description are exemplary and non-limiting. In some exemplary embodiments, the computing device 300 may include Figure 3 More or fewer components may be shown, or some components may be combined or separated, or may have a different arrangement of components.

[0059] The processor 310 may have a variety of specific implementation forms. For example, the processor 310 may include a central processing unit (CPU), a graphic processing unit (GPU), a neural-network processing unit (NPU), a tensor processing unit (TPU) or a data processing unit (DPU), etc., and the embodiment of the present application does not specifically limit it. The processor 310 may also be a single-core processor or a multi-core processor. The processor 310 may be a combination of a CPU and a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The processor 310 may also be implemented using a logic device with built-in processing logic alone, such as an FPGA or a digital signal processor (DSP). The communication interface 320 may be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface may be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface may be a cellular network interface or a wireless local area network interface, etc.

[0060] The memory 330 may be a non-volatile memory, such as a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The memory 330 may also be a volatile memory, which may be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM). The memory 330 may also be used to store program codes and data, so that the processor 310 calls the program codes stored in the memory 330 to execute some or all of the operation steps in the above method embodiment, or to execute the corresponding functions in the above device embodiment. Figure 3 Show more or fewer components, or have different component configurations.

[0061] The bus 340 may be a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 340 may be divided into an address bus, a data bus, a control bus, etc. In addition to the data bus, the bus 340 may also include a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0062] The method and device provided in the embodiments of the present application are based on the same inventive concept. Since the principles of solving the problems in the methods and devices are similar, the embodiments, implementation methods, examples or implementation methods of the methods and devices can refer to each other, and the repeated parts will not be repeated. The embodiments of the present application also provide a system, which includes multiple computing devices, and the structure of each computing device can refer to the structure of the computing device described above. The functions or operations that can be implemented by the system can refer to the specific implementation steps in the above method embodiments and / or the specific functions described in the above device embodiments, which will not be repeated here.

[0063] The present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer device (such as one or more processors), the method steps in the above method embodiment can be implemented. The specific implementation of the processor of the computer-readable storage medium in executing the above method steps can refer to the specific operations described in the above method embodiment and / or the specific functions described in the above device embodiment, which will not be repeated here.

[0064] It should be understood by those skilled in the art that the embodiments of the present application may be provided as methods, systems, or computer program products. The present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. The embodiments of the present application may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The present application may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media. Available media can be magnetic media (such as floppy disks, hard disks, tapes), optical media, or semiconductor media. Semiconductor media can be solid-state hard disks, random access memory, flash memory, read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, registers, or any other form of suitable storage media.

[0065] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. Each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0066] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. The steps in the method of the embodiment of the present application can be adjusted in order, merged or deleted according to actual needs; the modules in the system of the embodiment of the present application can be divided, merged or deleted according to actual needs. If these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims

1. A method for flow table matching, characterized in that: The method for flow table matching includes: Based on the hash value fields of at least one hash bucket included in the hash table, hash matching is performed to determine a matching hash bucket, wherein each of the at least one hash bucket includes a flow sequence number field, and the flow sequence number field is used to store a flow sequence number for a flow table index; Based on the flow sequence number field of the matching hash bucket, a flow table match is performed to determine a matching flow table entry, wherein the matching flow table entry is used to execute a message processing action. Among them, at least one flow sequence number is pre-identified as a disabled flow sequence number set, and the at least one flow sequence number corresponds one-to-one to at least one identifier. The method for flow table matching also includes: determining whether the at least one hash bucket has a corresponding identifier by detecting whether the flow sequence number field of each of the at least one hash bucket includes a flow sequence number belonging to the disabled flow sequence number set, the at least one flow sequence number includes an all-zero flow sequence number, and the identifier corresponding to the all-zero flow sequence number is a hash bucket data valid identifier. The first hash bucket is any hash bucket among the at least one hash bucket. When the flow sequence number stored in the flow sequence number field of the first hash bucket is the all-zero flow sequence number, the first hash bucket is determined to have invalid data, and when the flow sequence number stored in the flow sequence number field of the first hash bucket is not the all-zero flow sequence number, the first hash bucket is determined to have valid data.

2. The method for flow table matching according to claim 1, characterized in that: When the flow table entry corresponding to the first hash bucket is deleted, the flow sequence number stored in the flow sequence number field of the first hash bucket is the all-zero flow sequence number.

3. The method for flow table matching according to claim 1, characterized in that: The at least one hash bucket does not include a data valid identification field segment.

4. The method for flow table matching according to claim 1, characterized in that: The hash table is associated with at least one hash table identification field segment, and the at least one hash table identification field segment includes a hash bucket data valid identification field segment. The at least one identification corresponds one-to-one to the at least one hash table identification field segment, and by determining whether the at least one hash bucket has the at least one identification, detection based on the at least one hash table identification field segment is equivalently achieved.

5. The method for flow table matching according to claim 1, characterized in that: The disabled flow sequence number set is a plurality of discrete flow sequence numbers or a continuous flow sequence number range.

6. The method for flow table matching according to claim 5, characterized in that: The hash table is associated with a flow number disable mode register and a flow number disable mode register group, the flow number disable mode register is used to indicate that the disabled flow number set is the multiple discrete flow numbers or the continuous flow number range, the flow number disable mode register group is used to store the disabled flow number set, and the method for flow table matching also includes: by reading the flow number disable mode register and the flow number disable mode register group, thereby detecting whether the flow number field segment of each of the at least one hash buckets includes a flow number belonging to the disabled flow number set.

7. The method for flow table matching according to claim 1, characterized in that: The hash table is used for data stream transmission based on a first communication transmission protocol, and the at least one identifier is determined based on the first communication transmission protocol.

8. A computer device, characterized in that: The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1 to 7.