WO2021104393A1 - Method for achieving multi-rule flow classification, device, and storage medium - Google Patents

Method for achieving multi-rule flow classification, device, and storage medium Download PDF

Info

Publication number
WO2021104393A1
WO2021104393A1 PCT/CN2020/131891 CN2020131891W WO2021104393A1 WO 2021104393 A1 WO2021104393 A1 WO 2021104393A1 CN 2020131891 W CN2020131891 W CN 2020131891W WO 2021104393 A1 WO2021104393 A1 WO 2021104393A1
Authority
WO
WIPO (PCT)
Prior art keywords
hash
field
original
extracted
key
Prior art date
Application number
PCT/CN2020/131891
Other languages
French (fr)
Chinese (zh)
Inventor
傅斌
刘衡祁
Original Assignee
深圳市中兴微电子技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市中兴微电子技术有限公司 filed Critical 深圳市中兴微电子技术有限公司
Publication of WO2021104393A1 publication Critical patent/WO2021104393A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2441Traffic characterised by specific attributes, e.g. priority or QoS relying on flow classification, e.g. using integrated services [IntServ]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/7453Address table lookup; Address filtering using hashing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/74591Address table lookup; Address filtering using content-addressable memories [CAM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04QSELECTING
    • H04Q11/00Selecting arrangements for multiplex systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04QSELECTING
    • H04Q11/00Selecting arrangements for multiplex systems
    • H04Q11/0001Selecting arrangements for multiplex systems using optical switching
    • H04Q11/0062Network aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04QSELECTING
    • H04Q11/00Selecting arrangements for multiplex systems
    • H04Q11/0001Selecting arrangements for multiplex systems using optical switching
    • H04Q11/0062Network aspects
    • H04Q11/0067Provisions for optical access or distribution networks, e.g. Gigabit Ethernet Passive Optical Network (GE-PON), ATM-based Passive Optical Network (A-PON), PON-Ring

Definitions

  • This application relates to communications, for example, to a method, device, and storage medium for implementing multi-rule flow classification.
  • GPON Gigabit-capable Passive Optical Networks
  • ADSL Asymmetric Digital Subscriber Line
  • ONU GPON network terminal equipment-Optical Network Unit
  • the detection and processing of Ethernet packets by the chip is a very important link. It needs to identify a variety of packets in the network, and has different processing methods for different packets.
  • NP Network Processor
  • TCAM Ternary Content Addressable Memory
  • TCAM has many functions, and ONU terminal only uses one of them. A small part of the function is wasted. Whether it is the purchase of Intellectual Property (IP) or the consumption of chip area, from the terminal point of view, the cost is a sensitive factor; third, when using TCAM, there is a good chip. Rate issues, which also makes the cost further increase.
  • IP Intellectual Property
  • TCAM could not be used when performing flow classification processing.
  • at least 3 types of table lookups are required to look up a rule.
  • the first type is the rule extraction index table
  • the second type is the extraction rule table.
  • the third category is HASH lookup. If the original table lookup process is directly borrowed into the current NP architecture, the number of table lookups will become very large due to the limitation of the return bit width of the table lookup, and there is a delay in the table lookup, and the increase in delay will make the NP internal
  • the processing time of the threads becomes longer, which reduces the performance in disguise. In order to improve the performance, more threads can only be logically added to satisfy the application. But doing so will increase the area, that is, the cost will increase.
  • the embodiments of this application provide a method, device and storage medium for implementing multi-rule flow classification. Under the premise of ensuring that service packets can be processed flexibly, the delay in table lookup for NPs for flow classification rules is reduced architecturally, and GPON is reduced at the same time. The cost of the terminal chip.
  • a method for implementing multi-rule flow classification including:
  • the corresponding original field is generated based on the original field structure and the field to be extracted in the original input information
  • the target field with the highest priority is output as the output result.
  • a device including: a memory, and one or more processors;
  • Memory set to store one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any embodiment of the present application.
  • a storage medium is also provided, the storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any embodiment of the present application is implemented.
  • FIG. 1 is a flowchart of a method for implementing multi-rule flow classification according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a flow classification provided by an embodiment of the present application.
  • FIG. 3 is a flow chart of processing from HASH KEY preprocessing to comparison of HASH results in a flow classification according to an embodiment of the present application
  • Figure 4 is a schematic diagram of a HASH entry structure provided by an embodiment of the present application.
  • FIG. 5 is a flowchart of an expansion port acquisition item provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a reconfigurable structure of a HASH entry provided by an embodiment of the present application.
  • FIG. 7 is a structural block diagram of a device for implementing multi-rule flow classification according to an embodiment of the present application.
  • Fig. 8 is a schematic structural diagram of a device provided by an embodiment of the present application.
  • the input information includes 128-byte packet header data, port number, and other preprocessing information input by the previous module.
  • HASH matching is an exact match.
  • the lookup includes: a rule extraction index table lookup, a rule extraction rule table lookup, and a HASH lookup.
  • the return result of an NP table lookup is limited, that is, a rule lookup requires at least 3 times of the above three types of lookups, and the high probability is more than 3.
  • the basic service processing of two-layer messages also includes at least the learning and searching of Media Access Control (MAC) addresses, packet modification, and other branches. Function, which makes the number of table look-ups become very large.
  • MAC Media Access Control
  • the lookup table includes three types: rule extraction index table, extraction rule table, and HASH lookup.
  • the extraction of data can be completed by the microcode, and the purpose of the search rule extraction index table and the search extraction rule table is to extract data. Therefore, these two types of tables can be optimized under the NP architecture. Then analyze the HASH lookup. From the previous description, we can see that the solution to solve the flow classification function under the NP architecture is to use TCAM, and then the use of TCAM in GPON terminal products can be analyzed. TCAM applies its two characteristics to GPON terminals:
  • each entry has an independent MASK bit, and the TCAM will enter KEY&&MASK to get the KEY that the entry really focuses on.
  • This step completes the functions of the original rule extraction index and rule extraction table.
  • TCAM entries and corresponding MASK bits can be dynamically added and deleted, that is, the software can dynamically add rules and corresponding entries.
  • the TCAM selects the matching entry with the highest priority as the final result, and outputs the corresponding information to feedback to the microcode. .
  • This step is similar to the exact match search of HASH.
  • Each entry in the TCAM has a MASK bit.
  • TCAM does not support many items, and it can compare each item. If this work is done through pure logic, it is equivalent to a TCAM to complete this work. Therefore, this MASK bit needs to be analyzed according to the application scenarios of the current ONU project to meet the GPON terminal application as the passing criterion.
  • the output of the comparison result based on the matching priority of multiple entries is also a feature of TCAM.
  • FIG. 1 is a flowchart of a method for implementing multi-rule flow classification according to an embodiment of the present application. This embodiment is applied to reduce the delay in table lookup of the flow classification rule performed by the NP.
  • This embodiment may be executed by a device.
  • the device may be an optical network terminal.
  • the method in this embodiment includes S110-S140.
  • the HASH search instruction refers to an instruction that the flow classification process discovered by the microcode enters the field search stage.
  • the microcode detects that the process enters the field search stage, field splicing and assembly are started to generate the corresponding original fields.
  • the original field structure refers to the field structure used to look up the SDT table request. That is to say, after the microcode composes the corresponding original field, the SDT table search request is initiated.
  • the original field structure may include: the field to be extracted, the address of the SDT table to be searched, and the thread number of the current microcode.
  • the microcode when entering the field search phase, the microcode assembles the field to be extracted, the address of the SDT table to be searched, and the thread number of the current microcode according to the original field structure to generate the corresponding original field.
  • the field to be extracted refers to the field to be extracted by the microcode as required.
  • S120 Generate a corresponding intermediate field according to the original field and the content of the entry in the pre-configured SDT table.
  • the table entry content of the SDT table may include: multiple HASH access flag bits, HASH table identity (Identity, id) number flag bits, HASH field size flag bits, and HASH table width flag bits.
  • the microcode After the microcode generates the original field according to the original field structure, it initiates the SDT table search request. First, it searches the SDT table based on the address of the SDT table to be searched, and reads the contents of the entries in the SDT table, and then according to the pre-configuration
  • the intermediate field structure of SDT combines the entry content in the SDT table with the content in the original field to generate the corresponding intermediate field.
  • the intermediate field structure may include: the thread number of the current microcode, multiple HASH access flags, HASH table id number flags, HASH field size flags, HASH table width flags, and fields to be extracted.
  • the microcode reads the corresponding entry content from the SDT table, the entry content and the thread number of the current microcode in the original field and the field to be extracted are assembled according to the intermediate field structure to generate the corresponding intermediate field.
  • the preset HASH bucket refers to a pre-configured space for storing various fields.
  • the preset HASH bucket can be used to store a variety of different field widths, different types, and various fields corresponding to different HASH table widths, which is not limited.
  • the field to be extracted has its own attributes, such as its own bit width and the width of its own HASH table.
  • the preset HASH bucket can be searched according to the bit width of the field to be extracted and the width of the HASH table in the intermediate field to obtain at least one target field that matches the bit width of the field to be extracted and the width of the HASH table.
  • the preset HASH bucket is pre-configured, that is, there is no need to perform rule extraction index search and extraction rule related operations according to the field to be extracted, thereby greatly reducing the table lookup delay of the flow classification rule.
  • S140 According to the priority order of at least one target field, output the target field with the highest priority as an output result.
  • the target field with the highest priority is output as the output result, which means that when multiple rules take effect at the same time and need to be matched, according to the agreed priority
  • the result with the highest priority is selected in order for output.
  • generating the corresponding intermediate field according to the original field and the entry content in the pre-configured system equipment table SDT includes: reading the pre-configured SDT table according to the address of the SDT table to be searched in the original field, Obtain the corresponding entry content; based on the intermediate field structure, combine the entry content, the thread number of the current microcode in the original field, and the field to be extracted to generate the corresponding intermediate field.
  • the microcode searches the SDT table based on the address of the SDT table to be searched in the original field, and after finding the corresponding SDT table, reads the content of each entry in the SDT table; then, according to the structure of the intermediate field, The content of each entry in the SDT table is combined with the thread number of the current microcode in the original field and the field to be extracted to generate the corresponding intermediate field.
  • the method before searching for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket according to the intermediate field, the method further includes: determining the corresponding according to multiple HASH flag bits in the intermediate field For the HASH search strategy, the multi-HASH flag bit is used to indicate the number of HASH rules for the current multi-HASH search request.
  • the corresponding HASH search strategy can be determined according to the multiple HASH flag bits in the middle field.
  • the HASH search strategy is related to multiple HASH flag bits.
  • the HASH search strategy may include: a single HASH search strategy and a multiple HASH search strategy.
  • the single HASH lookup strategy is used to characterize the flow classification process through a single HASH path; the multiple HASH lookup strategy is used to characterize the flow classification process through multiple HASH paths.
  • searching for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket according to the intermediate field includes: Multi-HASH search strategy, and search the corresponding multi-HASH rule index table according to the HASH table id number in the middle field; determine the field corresponding to at least one target field from the preset HASH bucket according to the HASH table id number in the multi-HASH rule index table Bit width and HASH table width; generate at least one corresponding target field according to the field bit width and HASH table width.
  • the multiple HASH flag bits can be represented by the first value and the second value.
  • the first value is 1, and the second value is 0.
  • the multi-HASH flag bit is 1, it indicates that the flow classification process performs multiple HASH lookups, that is, the multi-HASH lookup strategy is adopted to determine the corresponding target field, that is, the multi-HASH lookup strategy is used for the first HASH lookup.
  • outputting the target field with the highest priority as the output result includes: determining the priority order of each target field; and using the target field with the highest priority as the output The result is output.
  • the priority of each target field is sorted, and the target field with the highest priority is output as the output result.
  • sorting the priority of the target field means that for a situation where there are multiple rules that take effect at the same time and need to be matched, the priority of each rule is sorted.
  • the method for implementing multi-rule flow classification further includes: storing the original input information and at least one output result in a combination of an idle pointer queue and a random access memory (Random Access Memory, RAM).
  • RAM Random Access Memory
  • the storage in the case of storing the output result obtained by executing the multi-HASH search strategy, the storage can be carried out in a combination of a free pointer queue and RAM.
  • the depth of RAM is related to the total number of threads.
  • the depth of the RAM can be set to N, and N depends on the total number of threads.
  • the original input information can be stored, or N output results can be stored, which is not limited.
  • FIG. 2 is a schematic flowchart of a flow classification provided by an embodiment of the present application. As shown in Figure 2, the flow classification process includes the following steps:
  • HASH KEY refers to the field in the above embodiment.
  • the process of extracting the HASH KEY includes: in the case of initializing the flow classification processing flow, the microcode command is used to perform KEY combination according to application needs.
  • the process of HASH KEY preprocessing includes: customizing an SDT table, flexibly responding to multiple HASH input conditions, and flexibly reprocessing HASH KEY for different input conditions.
  • different HASH table widths, different HASH KEY widths, and different result bit widths are defined according to application requirements, thereby satisfying the situation of multi-rule arbitration for flow classification.
  • the process of finding the HASH bucket includes: Corresponding to the HASH KEY in the HASH KEY preprocessing section, which can flexibly match different HASH KEY bit widths, and flexibly match according to different HASH table widths, and output the matched Corresponding results.
  • the process of comparing multiple HASH results includes: when there are multiple rules that take effect at the same time and need to be matched, the result with the highest priority is selected for output according to the pre-configured priority order.
  • FIG. 3 is a processing flowchart from HASH KEY preprocessing to comparison of HASH results in a flow classification provided in an embodiment of the present application. As shown in Figure 3, the processing flow includes the following steps:
  • the microcode detects that the flow classification process enters the HASH KEY extraction stage, and performs KEY extraction.
  • the microcode performs KEY assembly to generate original fields.
  • the search result is stored by using the combination of the idle pointer queue and the RAM.
  • the microcode when the microcode detects that the flow classification process enters the HASH KEY extraction stage, the splicing is started. First, the microcode performs HASH KEY assembly according to the original field structure to generate the corresponding original field.
  • Table 1 is a schematic table of an original field structure provided by an embodiment of the present application. As shown in Table 1, the original field structure includes: the field to be extracted, the address of the SDT table to be searched, and the thread number of the current microcode.
  • Table 1 A schematic table of the original field structure
  • HASH KEY may be used to indicate the field extracted by the microcode as needed, that is, the field to be extracted; sdt_num indicates the address of the SDT table to be searched; np_no indicates the thread number of the current microcode.
  • Table 2 is a schematic table of the structure of an SDT table provided in an embodiment of the present application.
  • Table 2 A schematic table of the structure of an SDT table
  • multi_hash may be used to indicate a multi-HASH flag bit; multi_table_id indicates a HASH table number; hash_key_size indicates a HASH KEY size flag bit; multi_tbl_width indicates a HASH table width flag bit.
  • multi_hash when multi_hash is 0, it indicates the length of the key value for accessing the HASH module, and the total HASH key value is 384 bits.
  • the hash_key_keytype is 128bit, the minimum supported granularity is 1byte, the value range of keysize is 1-14, and the corresponding HASH key length (in 8bit units) are: 000001-1*8bit, 000010-2*8bit , 001110-14*8bit, reserved for other cases;
  • the hash_key_keytype when the hash_key_keytype is 256bit, the minimum supported granularity is 2byte, the value range of keysize is 1-15, and the corresponding HASH key length (in 16bit units) are: 000001- 1*16bit, 000010-2*16bit, 001111-15*16bit, reserved for other cases;
  • hash_key_keytype is 384bit, the minimum supported granularity is 4byte, the value range of keysize is 1-12, and the corresponding HASH key length (
  • multi_tbl_width represents the HASH table width flag bit, which is used to store the bit width.
  • the key type is 2bit, which means that the length type of the HASH entry corresponding to the search is: 01-128bit, 10-256bit, 11-512bit, 00-384bit.
  • Table 3 is a schematic table of an intermediate field structure provided in an embodiment of the present application. As shown in Table 3, the intermediate field structure includes: the thread number of the current microcode, multiple hash flags, hash table number, hash key size flags, hash table width flags, and fields to be extracted.
  • the pre-processing module is used to pre-shunt.
  • the basic HASH path that is, the single HASH search strategy
  • 8bit information in the high position That is, 1bit multi hash+7bit multi hash index; when the multi hash in the middle field is 1, it means that multiple hash lookups need to be performed and multiple hash paths (ie, multiple hash lookup strategies) are required.
  • Table 4 is an index table of multiple HASH rules provided in an embodiment of the present application.
  • Table 4 A multi-HASH rule index table
  • Table 5 is a hash_table_id configuration table provided by an embodiment of the present application. As shown in Table 5, it includes: HASH table width, HASH KEY size, and HASH KEY location. Table 5 A configuration table of hash_table_id
  • the preprocessing module does not return the result immediately for the key raised by multi_hash, so it needs to be stored.
  • the storage adopts the free pointer queue + RAM, and the depth of RAM is set to N (N depends on the total number of threads). Storage is not only storing the original input signal, but also storing N output results (the bit width is determined by the application, and the highest bit is hit). In the embodiment, the next highest 5 bits of the output result are used as priority arbitration. (In the HASH table entry, it is the highest 5bit immediately following the key. After all the results are read, the result corresponding to the highest priority is taken.) A first-in-first-out (First In First Out) for storing the pointer to be processed is also required. FIFO) memory (that is, multi_index is stored). The first-in-first-out principle is adopted between N KEYs, and the next one is copied after one is copied.
  • the number of replications is determined based on the multi_num parameter in Table 4. For each replication, this parameter is reduced by one until it is reduced to 0, which means that the replication is over and the next replication is started.
  • the keys are assembled, they are sent to the basic HASH functional module. For the scheduling between the keys of multiple HASH and the keys of the original path, the round-robin (RR) method is currently used, and the two have the same priority.
  • the HASH function module searches, it returns the relevant parameters corresponding to the output result.
  • the HASH search scheme such as the reconfigurable HASH entry structure in the scheme, improves the utilization of RAM, reduces the number of threads of NP, and reduces the cost of the chip.
  • Fig. 4 is a schematic diagram of a HASH entry structure provided by an embodiment of the present application.
  • the HASH entry structure includes: entry valid flag (ie valid), key type flag (key_type), HASH table id (ie table_id), business key value (ie key) and output result (ie result) .
  • key_type when valid is 0, the current entry is an invalid HASH entry; when vaild is 1, the current entry is valid.
  • key_type is as follows: when key_type is 00, it means the key type is invalid; when key_type is 01, it means the key type is 128bit; when key_type is 10, it means the key type is 256bit; when key_type is 11, it means the key type is 512bit.
  • Result is user-defined result data
  • the highest 1bit no_result bit is reserved for chip hardware to instruct the microcode to check whether the HASH is hit (for example, 0 means hit, 1 means miss).
  • the length of the result actually returned to the microcode is determined by the rsp_mode in the SDT attribute. When the length of the result actually stored in the entry is greater than rsp_mode, the data is truncated when it is returned to the microcode. On the contrary, the low bit of the result is filled with 0 to the rsp_mode bit width.
  • FIG. 5 is a flowchart of an expansion port obtaining entry provided by an embodiment of the present application. As shown in Figure 5, this process includes the following steps:
  • the HASH request intercepts a valid key based on the width of the HASH table or the size of the HASH KEY, and performs HASH calculation with the ID number of the HASH table.
  • Fig. 6 is a schematic diagram of a reconfigurable structure of a HASH entry provided by an embodiment of the present application.
  • the HASH request input may include: np_no, multi_hash_index, multi_hash, multi_table_id, hash_key_size, and multi_tbl_width. Then, the HASH request intercepts a valid key based on multi_tbl_width or hash_key_size, and then adds multi_table_id for hash calculation, and executes the hash calculation step twice. Then, after the hash address is calculated by the hash, N bits of data are read from the hash bucket.
  • an access control list (Access Control List, ACL) rule for Layer 3 packets ie, L3
  • ACL Access Control List
  • L3 Layer 3 packets
  • the 7-tuple is taken as an example to describe the implementation process of multi-rule flow classification.
  • KEY is extracted, all the parameters of the 7-tuple are first extracted and spliced into a key (or original field), and the KEY bit width is between 64 and 128.
  • the software pre-configures an sdt_num corresponding to this multi-hash rule; then configures the sdt table corresponding to sdt_num, the parameters are described in sequence as follows: multi_hash: set to 1, indicating that multi-hash search is enabled; hash table width: meaningless here; multi_hash_addr: (That is, the original hash key size+hash table id) here means the first address of the multi-hash search. In one implementation, reservation is made according to the current usage, for example, 8 multi-hash lookups are reserved first, the first address is configured to be 0, and the first address of the next multi-hash is set to 8. In this case, there may be waste.
  • the value is configured as the value of the number of times used, for example, if it is not used at the beginning, it is configured to 0, and the parameter is set to 1 in the second configuration. , Which is the position of the next free pointer.
  • the first address is multi_hash_addr.
  • multi_num This parameter is as described in Table 4, and only the first address is valid. For example, currently only a 7-tuple search is performed, then this parameter is configured to 1, if a subsequent triple search is added , Then this parameter needs to be modified to 2.
  • hash_id hash_id and hash_table_id are configured together, corresponding to the real business table number, such as the current 7-tuple business, if the 7-tuple business has been set on other ports and the current extraction conditions are exactly the same, the currently set hash_id and hash_table_id Match with the previous hash_id and hash_table_id to save the business table number; hash_table_id: Same as above; hash_mul_next_addr: If the value of the remaining number of replications is greater than 1, then hash_mul_next_addr is meaningful. This parameter is similar to the multi_hash_addr configuration idea in the sdt table. Use the following two configuration methods to achieve.
  • hash_table_width corresponds to the bit width of the table entry.
  • the current key length is between 64 and 128, and the result is obtained by cascading.
  • the parameter is configured to 01, which is 128bit;
  • hash_key_size indicates that the current key length is 64 ⁇ 128, when the key length is 128bit, the value of hash_key_size is 0, if the key length is 64bit, then the value of hash_key_size is 8;
  • hash_key_location The current overall bit width is less than 128bit, and the key bit width is also 128bit, select 0, see Table 5 for other more value descriptions;
  • hash_key_mask The current overall bit width is only used less than 128bit, and the key bit width is also 128bit, then the mask bit [127:0] is valid, and according to the current The actual bit width of the 7-tuple is actually intercepted. For example, if the 7-
  • the first 128-bit entry has been configured in the bit width of the 512-bit RAM, occupying [511:384] bits.
  • the second 128bit entry is configured, occupying [383:256]bit.
  • 256bit When there is another item HASH to the same address, and 256bit is required, it can be configured in [255:0] at this time.
  • Fig. 7 is a structural block diagram of a device for implementing multi-rule flow classification provided by an embodiment of the present application. This embodiment is applied to reduce the delay in table lookup of the flow classification rule performed by the NP. As shown in FIG. 7, the device in this embodiment includes: a first generation module 510, a second generation module 520, a search module 530, and an output module 540.
  • the first generation module 510 is configured to generate corresponding original fields based on the original field structure and according to the fields to be extracted in the original input information when the hash HASH search instruction trigger is detected; the second generation module 520 is configured to According to the original field and the content of the entries in the pre-configured system device table SDT, the corresponding intermediate field is generated; the search module 530 is set to search the preset HASH bucket according to the intermediate field and the bit width and the width of the HASH table of the field to be extracted At least one matched target field; the output module 540 is configured to output the target field with the highest priority as the output result according to the priority order of the at least one target field.
  • the device for implementing multi-rule flow classification provided in this embodiment is configured to implement the method for implementing multi-rule flow classification in the embodiment shown in FIG. 1.
  • the implementation principle and technical effect of the device for implementing multi-rule flow classification provided in this embodiment are similar. I won't repeat it here.
  • the first generation module 510 is configured to combine the address of the SDT table to be searched, the thread number of the current microcode, and the field to be extracted in the original input information according to the original field structure to generate the corresponding original field structure. Field.
  • the second generating module 520 includes: a reading unit configured to read the pre-configured SDT table according to the address of the SDT table to be looked up in the original field to obtain the corresponding table item content; the first generating unit , It is set to combine the content of the table entry, the thread number of the current microcode in the original field, and the field to be extracted based on the structure of the intermediate field to generate the corresponding intermediate field.
  • the device for implementing multi-rule flow classification further includes: a determining module configured to search for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket according to the intermediate field Previously, the corresponding HASH search strategy was determined according to the multi-HASH flag bit in the middle field.
  • the multi-HASH flag bit is used to indicate the number of hash rules for the current multi-HASH search request.
  • the hash search strategy includes a multi-HASH search strategy.
  • the search module 530 when the multi-HASH flag bit is the first value, includes: a search unit, configured to search based on a multi-HASH search strategy, and search for the corresponding multi-HASH table ID according to the HASH table id number in the middle field. HASH rule index table; a first determining unit configured to determine the field bit width and HASH table width corresponding to at least one target field from the preset HASH bucket according to the HASH table id number in the multi-HASH rule index table; second generation The unit is set to generate at least one corresponding target field according to the bit width of the field and the width of the HASH table.
  • the output module 540 includes: a second determining unit configured to determine the priority order of each target field; and an output unit configured to output the target field with the highest priority as an output result.
  • the device for implementing multi-rule flow classification further includes: a storage module configured to store the original input information and at least one output result in a combination of an idle pointer queue and RAM.
  • the depth of RAM is related to the total number of threads.
  • Fig. 8 is a schematic structural diagram of a device provided by an embodiment of the present application.
  • the device provided by the present application includes: a processor 610 and a memory 620.
  • the number of processors 610 in the device may be one or more.
  • one processor 610 is taken as an example.
  • the number of memories 620 in the device may be one or more.
  • one memory 620 is taken as an example.
  • the processor 610 and the memory 620 of the device are connected through a bus or in other ways. In FIG. 8, the connection through a bus is taken as an example.
  • the device is an optical network terminal.
  • the memory 620 can be configured to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the device of any embodiment of the present application (for example, in the device for implementing multiple rule flow classification)
  • the first generation module, the second generation module, the search module and the output module may include a program storage area and a data storage area.
  • the program storage area may store an operating system and an application program required by at least one function; the data storage area may store data created according to the use of the device, and the like.
  • the memory 620 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
  • the memory 620 may further include a memory remotely provided with respect to the processor 610, and these remote memories may be connected to the device through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the above-provided device can be configured to implement the multi-rule flow classification implementation method provided by any of the above-mentioned embodiments, and has corresponding functions and effects.
  • the embodiment of the present application also provides a storage medium containing computer-executable instructions.
  • the computer-executable instructions are executed by a computer processor, they are used to implement a method for implementing multi-rule flow classification.
  • the method includes: When the HASH lookup command is triggered, the corresponding original field is generated based on the original field structure and the field to be extracted in the original input information; the corresponding intermediate field is generated according to the original field and the content of the entry in the pre-configured system equipment table SDT Field; according to the intermediate field, find at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket; according to the priority order of at least one target field, the target field with the highest priority is used as the output result Perform output.
  • user equipment encompasses any suitable type of wireless user equipment, such as a mobile phone, a portable data processing device, a portable web browser, or a vehicle-mounted mobile station.
  • Computer program instructions can be assembly instructions, Instruction Set Architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or written in any combination of one or more programming languages Source code or object code.
  • ISA Instruction Set Architecture
  • the block diagram of any logic flow in the drawings of the present application may represent program steps, or may represent interconnected logic circuits, modules, and functions, or may represent a combination of program steps and logic circuits, modules, and functions.
  • the computer program can be stored on the memory.
  • the memory can be of any type suitable for the local technical environment and can be implemented using any suitable data storage technology, such as but not limited to read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), optical Memory devices and systems (Digital Video Disc (DVD) or Compact Disk (CD)), etc.
  • Computer-readable media may include non-transitory storage media.
  • the data processor can be any type suitable for the local technical environment, such as but not limited to general-purpose computers, special-purpose computers, microprocessors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (ASICs) ), programmable logic devices (Field-Programmable Gate Array, FPGA), and processors based on multi-core processor architecture.
  • DSP Digital Signal Processors
  • ASICs application specific integrated circuits
  • FPGA Field-Programmable Gate Array
  • processors based on multi-core processor architecture such as but not limited to general-purpose computers, special-purpose computers, microprocessors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (ASICs) ), programmable logic devices (Field-Programmable Gate Array, FPGA), and processors based on multi-core processor architecture.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Provided in the present application are a method for achieving multi-rule flow classification, a device, and a storage medium. The method comprises: in the situation in which it is detected that a hash lookup instruction is triggered, generating a corresponding original field on the basis of an original field structure and according to a field to be extracted in original input information; generating a corresponding intermediate field according to the original field and table item content in a pre-configured system device table (SDT); according to the intermediate field, searching a preset hash bucket for at least one target field matching both the bit width of the field to be extracted and the hash table width; and, according to the order of priority of the at least one target field, using the target field having the highest priority as an output result for output.

Description

多规则流分类的实现方法、设备和存储介质Method, equipment and storage medium for implementing multi-rule flow classification
本申请要求在2019年11月27日提交中国专利局、申请号为201911183380.6的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office with an application number of 201911183380.6 on November 27, 2019. The entire content of this application is incorporated into this application by reference.
技术领域Technical field
本申请涉及通信,例如涉及一种多规则流分类的实现方法、设备和存储介质。This application relates to communications, for example, to a method, device, and storage medium for implementing multi-rule flow classification.
背景技术Background technique
千兆无源光网络(Gigabit-capable Passive Optical Networks,GPON)是PON系列技术中架构最完备、标准内容最完整的网络技术,现在已大量使用于接入网,是用于取代非对称数字用户环路(Asymmetric Digital Subscriber Line,ADSL)接入技术的最佳方案。GPON网络终端设备——光网络单元(Optical Network Unit,ONU)是GPON套片的核心芯片之一。芯片对以太网报文的探测和处理是一个非常重要的环节,它需要识别网络中多种形形色色的报文,针对不同的报文有不同的处理方式。Gigabit-capable Passive Optical Networks (GPON) is the network technology with the most complete architecture and the most complete standard content in the PON series of technologies. It has been widely used in access networks and is used to replace asymmetric digital users. The best solution for loop (Asymmetric Digital Subscriber Line, ADSL) access technology. GPON network terminal equipment-Optical Network Unit (ONU) is one of the core chips of GPON chips. The detection and processing of Ethernet packets by the chip is a very important link. It needs to identify a variety of packets in the network, and has different processing methods for different packets.
随着业务的不断丰富,在不同的场景下,相同报文的处理方式也不尽相同。而网络处理器(Network Processor,NP)技术中的微码编辑可以根据不同处理方式进行不同的组合。因此,使用NP技术处理报文业务就变得非常重要。With the continuous enrichment of services, the processing methods of the same message are different in different scenarios. The microcode editing in the Network Processor (NP) technology can be combined in different ways according to different processing methods. Therefore, it becomes very important to use NP technology to process message services.
在NP技术中,进行流分类主要是基于三态内容寻址存储器(Ternary Content Addressable Memory,TCAM)进行;使用TCAM有一个好处:针对一指定场景,可以将需要提取的特征字段固化。In NP technology, stream classification is mainly based on Ternary Content Addressable Memory (TCAM); using TCAM has an advantage: for a specified scene, the feature fields that need to be extracted can be solidified.
但是使用TCAM有几个方面需要考虑:一个是针对GPON终端的场景中,需要的条目数非常多,而TCAM的容量一般不大;二是TCAM的功能很多,ONU终端使用到的只是其中的一小部分功能,存在浪费,不管是在购买知识产权(Intellectual Property,IP)上,还是在芯片面积消耗上,从终端来看,成本都是一个敏感因素;三是使用TCAM时,存在一个芯片良率问题,这也使得成本进一步增加。However, there are several aspects to consider when using TCAM: one is that in the scenario of GPON terminal, the number of entries required is very large, and the capacity of TCAM is generally not large; the other is that TCAM has many functions, and ONU terminal only uses one of them. A small part of the function is wasted. Whether it is the purchase of Intellectual Property (IP) or the consumption of chip area, from the terminal point of view, the cost is a sensitive factor; third, when using TCAM, there is a good chip. Rate issues, which also makes the cost further increase.
在NP架构之前,进行流分类处理时,可以不使用TCAM,此时对一个规则进行查表需要至少进行3类查表,第一类是规则提取索引表,第二类是提取规则表,第三类是HASH查找。如果将原来的查表流程直接借用到当前的NP架构中,因为查表返回位宽的限制,查表次数会变得非常多,而查表是存在延时 的,延时增加会使得NP内部的线程的处理时间变长,从而变相地降低了性能,为了提升性能,只能在逻辑上增加更多的线程以满足应用。但是这样做又会导致面积增加,也就是成本又提高了。Before the NP architecture, TCAM could not be used when performing flow classification processing. At this time, at least 3 types of table lookups are required to look up a rule. The first type is the rule extraction index table, and the second type is the extraction rule table. The third category is HASH lookup. If the original table lookup process is directly borrowed into the current NP architecture, the number of table lookups will become very large due to the limitation of the return bit width of the table lookup, and there is a delay in the table lookup, and the increase in delay will make the NP internal The processing time of the threads becomes longer, which reduces the performance in disguise. In order to improve the performance, more threads can only be logically added to satisfy the application. But doing so will increase the area, that is, the cost will increase.
通过上面描述可知,直接在NP架构下使用TCAM对于GPON终端应用并不是非常理想的选择,同时使用非NP架构下的流分类规则,也不能和NP架构完美契合。From the above description, it can be seen that using TCAM directly under the NP architecture is not a very ideal choice for GPON terminal applications. At the same time, using the flow classification rules under the non-NP architecture cannot perfectly fit the NP architecture.
发明内容Summary of the invention
本申请实施例提供一种多规则流分类的实现方法、设备和存储介质,在保证业务报文能灵活处理的前提下,从架构上降低NP进行流分类规则的查表延时,同时降低GPON终端芯片的成本。The embodiments of this application provide a method, device and storage medium for implementing multi-rule flow classification. Under the premise of ensuring that service packets can be processed flexibly, the delay in table lookup for NPs for flow classification rules is reduced architecturally, and GPON is reduced at the same time. The cost of the terminal chip.
提供一种多规则流分类的实现方法,包括:A method for implementing multi-rule flow classification is provided, including:
在检测到哈希HASH查找指令触发的情况下,基于原始字段结构,并根据原始输入信息中的待提取字段生成对应的原始字段;In the case of detecting that the hash HASH search instruction is triggered, the corresponding original field is generated based on the original field structure and the field to be extracted in the original input information;
根据所述原始字段和预先配置的系统设备表SDT中的表项内容,生成对应的中间字段;Generate corresponding intermediate fields according to the original fields and the contents of the entries in the pre-configured system equipment table SDT;
按照所述中间字段从预设HASH桶中查找与所述待提取字段的位宽和HASH表宽度匹配的至少一个目标字段;Searching for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket according to the intermediate field;
按照所述至少一个目标字段的优先级顺序,将优先级最高的目标字段作为输出结果进行输出。According to the priority order of the at least one target field, the target field with the highest priority is output as the output result.
还提供一种设备,包括:存储器,以及,一个或多个处理器;器A device is also provided, including: a memory, and one or more processors;
存储器,设置为存储一个或多个程序;Memory, set to store one or more programs;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本申请任一实施例所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any embodiment of the present application.
还提供了一种存储介质,所述存储介质存储有计算机程序,所述计算机程序被处理器执行时实现本申请任一实施例所述的方法。A storage medium is also provided, the storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any embodiment of the present application is implemented.
附图说明Description of the drawings
图1是本申请实施例提供的一种多规则流分类的实现方法的流程图;FIG. 1 is a flowchart of a method for implementing multi-rule flow classification according to an embodiment of the present application;
图2是本申请实施例提供的一种流分类的流程示意图;FIG. 2 is a schematic flowchart of a flow classification provided by an embodiment of the present application;
图3是本申请实施例提供的一种流分类中从HASH KEY预处理至多HASH结果比较之间的处理流程图;FIG. 3 is a flow chart of processing from HASH KEY preprocessing to comparison of HASH results in a flow classification according to an embodiment of the present application;
图4是本申请实施例提供的一种HASH条目结构示意图;Figure 4 is a schematic diagram of a HASH entry structure provided by an embodiment of the present application;
图5是本申请实施例提供的一种扩展端口获取条目的流程图;FIG. 5 is a flowchart of an expansion port acquisition item provided by an embodiment of the present application;
图6是本申请实施例提供的一种HASH条目可重构结构示意图;FIG. 6 is a schematic diagram of a reconfigurable structure of a HASH entry provided by an embodiment of the present application;
图7是本申请实施例提供的一种多规则流分类的实现装置的结构框图;FIG. 7 is a structural block diagram of a device for implementing multi-rule flow classification according to an embodiment of the present application;
图8是本申请实施例提供的一种设备的结构示意图。Fig. 8 is a schematic structural diagram of a device provided by an embodiment of the present application.
具体实施方式Detailed ways
下文中将结合附图对本申请的实施例进行说明。在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。Hereinafter, the embodiments of the present application will be described with reference to the drawings. In the case of no conflict, the embodiments in the application and the features in the embodiments can be combined with each other arbitrarily.
在本申请的实施例中,通过对已有NP微码特性、流分类流程的深入分析,一方面要避免使用TCAM,一方面又需要满足当前应用,从而解决GPON终端应用遇到查表的时延问题。In the embodiment of this application, through in-depth analysis of the existing NP microcode characteristics and flow classification process, on the one hand, it is necessary to avoid the use of TCAM, on the other hand, it needs to meet the current application, so as to solve the problem of GPON terminal application encountering table lookup. Delay the problem.
在已有流分类流程中,包括如下步骤:In the existing flow classification process, the following steps are included:
S1、输入信息包含128字节包头数据、端口号以及前级模块输入的其他预处理信息。S1. The input information includes 128-byte packet header data, port number, and other preprocessing information input by the previous module.
S2、基于端口号查提取规则索引表,得到提取规则的对应地址以及关于每个提取规则是否有效指示的信息。S2. Check the extraction rule index table based on the port number, and obtain the corresponding address of the extraction rule and information about whether each extraction rule is valid or not.
S3、基于每个有效的提取规则索引查找提取规则表。S3. Look up the extraction rule table based on each effective extraction rule index.
S4、基于提取规则表得到的内容,从128字节包头数据中提取相应字段,以及一些预处理信息组成key,进行HASH查找匹配操作。HASH匹配为精确匹配。S4. Based on the content obtained from the extraction rule table, extract the corresponding fields from the 128-byte packet header data, and form a key with some pre-processing information, and perform a HASH search and matching operation. HASH matching is an exact match.
S5、如果所有规则均没有匹配,则该报文按照提取规则索引表的“全部未匹配的默认动作”进行处理,如果有且仅有一个规则匹配,那么按照该规则的结果输出,如果有多个规则有效,那么按照多个规则的结果的优先级高低,取优先级最高的结果输出。S5. If all the rules are not matched, the message is processed according to the "default action for all unmatched" in the extraction rule index table. If there is and only one rule is matched, then output according to the result of the rule. If there is more If one rule is valid, then according to the priority of the results of multiple rules, the result with the highest priority is output.
若按照已有流分类流程,进行一次规则查表,则查表包括:一次规则提取索引表查找,一次提取规则表查找,以及一次HASH查找。而一次NP查表的返回结果是有限的,即一次规则查表需要至少3次上述三类查找,并且大概率是超过3次。If a rule lookup is performed according to the existing flow classification process, the lookup includes: a rule extraction index table lookup, a rule extraction rule table lookup, and a HASH lookup. The return result of an NP table lookup is limited, that is, a rule lookup requires at least 3 times of the above three types of lookups, and the high probability is more than 3.
根据当前GPON终端应用来看,对业务报文规则采用已有流分类流程进行查表的次数超过3次很常见。因此总的查表次数相当于需要10次以上,两层报文(即L2)的基本业务处理至少还包含媒体访问控制(Media Access Control, MAC)地址的学习和查找,包修改,以及其他分支功能,从而使得查表次数变得非常多。According to the current GPON terminal application, it is common for the service message rules to use the existing flow classification process to check the table more than 3 times. Therefore, the total number of table lookups is equivalent to more than 10 times. The basic service processing of two-layer messages (ie L2) also includes at least the learning and searching of Media Access Control (MAC) addresses, packet modification, and other branches. Function, which makes the number of table look-ups become very large.
而NP架构下,在理想情况下64字节达到线速,查表次数必须尽可能少。因此,NP架构下如果按照原有流程操作,则查表次数过多,且需依次分析每次查表,考虑是否可优化以及如何优化,由此很难满足GPON终端应用。如之前所述,查表包含3类:规则提取索引表,提取规则表,HASH查找。Under the NP architecture, under ideal circumstances, 64 bytes reach the line speed, and the number of table lookups must be as few as possible. Therefore, under the NP architecture, if the original process is followed, there will be too many table lookups, and each table lookup must be analyzed in turn to consider whether it can be optimized and how to optimize it, which makes it difficult to meet GPON terminal applications. As mentioned earlier, the lookup table includes three types: rule extraction index table, extraction rule table, and HASH lookup.
根据已有NP架构中微码的作用,可以知道提取数据可以由微码完成,而查找规则提取索引表和查找提取规则表的目的是为了提取数据。因此可以在NP架构下,对这两类表进行优化。然后分析HASH查找。通过之前描述可知,NP架构下解决流分类功能的解决方案是使用TCAM,则可以分析TCAM在GPON终端产品中的使用情况。TCAM在GPON终端应用了其两个特性:According to the role of the microcode in the existing NP architecture, it can be known that the extraction of data can be completed by the microcode, and the purpose of the search rule extraction index table and the search extraction rule table is to extract data. Therefore, these two types of tables can be optimized under the NP architecture. Then analyze the HASH lookup. From the previous description, we can see that the solution to solve the flow classification function under the NP architecture is to use TCAM, and then the use of TCAM in GPON terminal products can be analyzed. TCAM applies its two characteristics to GPON terminals:
其一,在TCAM内部,每个条目有独立的MASK位,TCAM将输入KEY&&MASK,得到真正该条目关注的KEY,此步骤即完成了原有规则提取索引和规则提取表的功能。TCAM的条目和对应MASK位可以动态添加和删除,即软件可以动态添加规则以及对应的条目了。First, in the TCAM, each entry has an independent MASK bit, and the TCAM will enter KEY&&MASK to get the KEY that the entry really focuses on. This step completes the functions of the original rule extraction index and rule extraction table. TCAM entries and corresponding MASK bits can be dynamically added and deleted, that is, the software can dynamically add rules and corresponding entries.
其二,将MASK后的数据与条目进行精确匹配,此时存在多个条目匹配的情况,TCAM根据条目的优先级不同选择优先级最高的匹配条目作为最终的结果,输出对应信息反馈给微码。此步骤类似与HASH的精确匹配查找。Second, the data after the MASK is accurately matched with the entry. At this time, there are multiple entries matching. According to the priority of the entry, the TCAM selects the matching entry with the highest priority as the final result, and outputs the corresponding information to feedback to the microcode. . This step is similar to the exact match search of HASH.
TCAM内部每个条目都有一个MASK位。TCAM支持的条目数不多,它可以做到对每个条目都进行比较。如果通过纯逻辑完成这个工作,相当于就是一个TCAM完成这个工作。因此这个MASK位需要根据当前ONU项目的应用场景进行分析,以满足GPON终端应用为通过准则。而根据多个条目匹配的优先级比较结果输出,也属于TCAM的特性。Each entry in the TCAM has a MASK bit. TCAM does not support many items, and it can compare each item. If this work is done through pure logic, it is equivalent to a TCAM to complete this work. Therefore, this MASK bit needs to be analyzed according to the application scenarios of the current ONU project to meet the GPON terminal application as the passing criterion. The output of the comparison result based on the matching priority of multiple entries is also a feature of TCAM.
在一实现方式中,图1是本申请实施例提供的一种多规则流分类的实现方法的流程图。本实施例应用于降低NP进行流分类规则的查表延时的情况。本实施例可以由设备来执行,示例型地,设备可以为光网络终端。In an implementation manner, FIG. 1 is a flowchart of a method for implementing multi-rule flow classification according to an embodiment of the present application. This embodiment is applied to reduce the delay in table lookup of the flow classification rule performed by the NP. This embodiment may be executed by a device. For example, the device may be an optical network terminal.
如图1所示,本实施例中的方法包括S110-S140。As shown in Figure 1, the method in this embodiment includes S110-S140.
S110、在检测到哈希(HASH)查找指令触发的情况下,基于原始字段结构,并根据原始输入信息中的待提取字段生成对应的原始字段。S110: In the case of detecting that a hash (HASH) search instruction is triggered, generate a corresponding original field based on the original field structure and according to the field to be extracted in the original input information.
在实施例中,HASH查找指令指的是由微码发现的流分类的流程进入到字段查找阶段的指令。在实施例中,在微码检测到流程进入到字段查找阶段时,开始进行字段拼接组装,以生成对应的原始字段。In the embodiment, the HASH search instruction refers to an instruction that the flow classification process discovered by the microcode enters the field search stage. In the embodiment, when the microcode detects that the process enters the field search stage, field splicing and assembly are started to generate the corresponding original fields.
在一实施例中,基于原始字段结构,并根据原始输入信息中的待提取字段 生成对应的原始字段,包括:按照原始字段结构,将待查找系统设备表(System Device Table,SDT)的地址、当前微码的线程号和原始输入信息中的待提取字段进行组合,生成对应的原始字段。在实施例中,原始字段结构指的是用于查找SDT表请求的字段结构。也就是说,在微码组成对应的原始字段之后,发起查找SDT表请求。示例性地,原始字段结构可以包括:待提取字段、待查找SDT表的地址和当前微码的线程号。在实施例中,在进入到字段查找阶段的情况下,微码按照原始字段结构,将待提取字段、待查找SDT表的地址和当前微码的线程号进行组装,以生成对应的原始字段。在实施例中,待提取字段指的是微码根据需要所要提取的字段。In one embodiment, based on the original field structure and generating the corresponding original field according to the field to be extracted in the original input information, including: according to the original field structure, the address of the system device table (SDT) to be searched, The thread number of the current microcode is combined with the field to be extracted in the original input information to generate the corresponding original field. In the embodiment, the original field structure refers to the field structure used to look up the SDT table request. That is to say, after the microcode composes the corresponding original field, the SDT table search request is initiated. Exemplarily, the original field structure may include: the field to be extracted, the address of the SDT table to be searched, and the thread number of the current microcode. In the embodiment, when entering the field search phase, the microcode assembles the field to be extracted, the address of the SDT table to be searched, and the thread number of the current microcode according to the original field structure to generate the corresponding original field. In the embodiment, the field to be extracted refers to the field to be extracted by the microcode as required.
S120、根据原始字段和预先配置的SDT表中的表项内容,生成对应的中间字段。S120: Generate a corresponding intermediate field according to the original field and the content of the entry in the pre-configured SDT table.
在实施例中,SDT表的表项内容可以包括:多HASH访问标志位、HASH表身份标识(Identity,id)号标志位、HASH字段大小标志位和HASH表宽度标志位。在实施例中,在微码根据原始字段结构生成原始字段之后,发起查找SDT表请求,首先基于待查找SDT表的地址查找SDT表,以及读取SDT表中的表项内容,然后按照预先配置的中间字段结构对SDT表中的表项内容和原始字段中的内容进行结合,以生成对应的中间字段。中间字段结构可以包括:当前微码的线程号、多HASH访问标志位、HASH表id号标志位、HASH字段大小标志位、HASH表宽度标志位和待提取字段。在微码从SDT表中读取到对应的表项内容之后,按照中间字段结构对表项内容和原始字段中的当前微码的线程号以及待提取字段进行组装,以生成对应的中间字段。In an embodiment, the table entry content of the SDT table may include: multiple HASH access flag bits, HASH table identity (Identity, id) number flag bits, HASH field size flag bits, and HASH table width flag bits. In the embodiment, after the microcode generates the original field according to the original field structure, it initiates the SDT table search request. First, it searches the SDT table based on the address of the SDT table to be searched, and reads the contents of the entries in the SDT table, and then according to the pre-configuration The intermediate field structure of SDT combines the entry content in the SDT table with the content in the original field to generate the corresponding intermediate field. The intermediate field structure may include: the thread number of the current microcode, multiple HASH access flags, HASH table id number flags, HASH field size flags, HASH table width flags, and fields to be extracted. After the microcode reads the corresponding entry content from the SDT table, the entry content and the thread number of the current microcode in the original field and the field to be extracted are assembled according to the intermediate field structure to generate the corresponding intermediate field.
S130、按照中间字段从预设HASH桶中查找与待提取字段的位宽和HASH表宽度匹配的至少一个目标字段。S130. Search for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket according to the intermediate field.
在实施例中,预设HASH桶指的是预先配置的存储多种字段的空间。预设HASH桶可以用于存储多种不同字段宽度、不同类型以及不同HASH表宽度对应的多种字段,对此并不进行限定。在实施例中,待提取字段具备自身属性,比如,自身的位宽和所属HASH表宽度。在得到中间字段之后,可以根据中间字段中待提取字段的位宽和HASH表宽度对预设HASH桶进行查找,以得到与待提取字段的位宽和HASH表宽度匹配的至少一个目标字段。在实施例中,预设HASH桶是预先配置的,即无需根据待提取字段,执行规则提取索引的查找以及提取规则的相关操作,从而大大降低了流分类规则的查表延时。In the embodiment, the preset HASH bucket refers to a pre-configured space for storing various fields. The preset HASH bucket can be used to store a variety of different field widths, different types, and various fields corresponding to different HASH table widths, which is not limited. In the embodiment, the field to be extracted has its own attributes, such as its own bit width and the width of its own HASH table. After the intermediate field is obtained, the preset HASH bucket can be searched according to the bit width of the field to be extracted and the width of the HASH table in the intermediate field to obtain at least one target field that matches the bit width of the field to be extracted and the width of the HASH table. In the embodiment, the preset HASH bucket is pre-configured, that is, there is no need to perform rule extraction index search and extraction rule related operations according to the field to be extracted, thereby greatly reducing the table lookup delay of the flow classification rule.
S140、按照至少一个目标字段的优先级顺序,将优先级最高的目标字段作为输出结果进行输出。S140: According to the priority order of at least one target field, output the target field with the highest priority as an output result.
在实施例中,按照至少一个目标字段的优先级排序,将优先级最高的目标 字段作为输出结果进行输出,指的是在存在多个规则同时生效且需要匹配的情况下,按照约定的优先级顺序选择优先级最高的结果进行输出。在保证业务报文灵活处理的前提下,从架构上降低NP进行流分类规则的查表延时,同时降低GPON终端芯片的成本。In the embodiment, according to the priority order of at least one target field, the target field with the highest priority is output as the output result, which means that when multiple rules take effect at the same time and need to be matched, according to the agreed priority The result with the highest priority is selected in order for output. On the premise of ensuring flexible processing of service messages, the architecture reduces the delay of NP's table lookup for flow classification rules, and at the same time reduces the cost of GPON terminal chips.
在一实施例中,根据原始字段和预先配置的系统设备表SDT中的表项内容,生成对应的中间字段,包括:根据原始字段中的待查找SDT表的地址读取预先配置的SDT表,得到对应的表项内容;基于中间字段结构,对表项内容、原始字段中的当前微码的线程号和待提取字段进行组合,生成对应的中间字段。In an embodiment, generating the corresponding intermediate field according to the original field and the entry content in the pre-configured system equipment table SDT includes: reading the pre-configured SDT table according to the address of the SDT table to be searched in the original field, Obtain the corresponding entry content; based on the intermediate field structure, combine the entry content, the thread number of the current microcode in the original field, and the field to be extracted to generate the corresponding intermediate field.
在实施例中,微码基于原始字段中的待查找SDT表的地址查找SDT表,在查找到对应的SDT表之后,读取SDT表中的每个表项内容;然后根据中间字段结构,将SDT表中的每个表项内容和原始字段中的当前微码的线程号以及待提取字段进行组合,生成对应的中间字段。In the embodiment, the microcode searches the SDT table based on the address of the SDT table to be searched in the original field, and after finding the corresponding SDT table, reads the content of each entry in the SDT table; then, according to the structure of the intermediate field, The content of each entry in the SDT table is combined with the thread number of the current microcode in the original field and the field to be extracted to generate the corresponding intermediate field.
在一实施例中,在按照中间字段从预设HASH桶中查找与待提取字段的位宽和HASH表宽度匹配的至少一个目标字段之前,还包括:根据中间字段中的多HASH标志位确定对应的HASH查找策略,多HASH标志位用于表示当前多HASH查找请求的HASH规则数目。In an embodiment, before searching for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket according to the intermediate field, the method further includes: determining the corresponding according to multiple HASH flag bits in the intermediate field For the HASH search strategy, the multi-HASH flag bit is used to indicate the number of HASH rules for the current multi-HASH search request.
在实施例中,可根据中间字段中的多HASH标志位来确定对应的HASH查找策略。也就是说,HASH查找策略与多HASH标志位有关。在实施例中,HASH查找策略可以包括:单HASH查找策略和多HASH查找策略。单HASH查找策略用于表征流分类流程通过单HASH通路进行处理;多HASH查找策略用于表征流分类流程通过多HASH通路进行处理。In an embodiment, the corresponding HASH search strategy can be determined according to the multiple HASH flag bits in the middle field. In other words, the HASH search strategy is related to multiple HASH flag bits. In an embodiment, the HASH search strategy may include: a single HASH search strategy and a multiple HASH search strategy. The single HASH lookup strategy is used to characterize the flow classification process through a single HASH path; the multiple HASH lookup strategy is used to characterize the flow classification process through multiple HASH paths.
在一实施例中,在多HASH标志位为第一数值的情况下,按照中间字段从预设HASH桶中查找与待提取字段的位宽和HASH表宽度匹配的至少一个目标字段,包括:基于多HASH查找策略,并按照中间字段中的HASH表id号查找对应的多HASH规则索引表;根据多HASH规则索引表中的HASH表id号从预设HASH桶中确定至少一个目标字段对应的字段位宽和HASH表宽度;根据字段位宽和HASH表宽度生成对应的至少一个目标字段。In one embodiment, when the multiple HASH flag bits are the first value, searching for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket according to the intermediate field includes: Multi-HASH search strategy, and search the corresponding multi-HASH rule index table according to the HASH table id number in the middle field; determine the field corresponding to at least one target field from the preset HASH bucket according to the HASH table id number in the multi-HASH rule index table Bit width and HASH table width; generate at least one corresponding target field according to the field bit width and HASH table width.
在实施例中,多HASH标志位可通过第一数值和第二数值进行表示。示例性地,第一数值为1,第二数值为0。在实施例中,在多HASH标志位为1的情况下,表明流分类流程进行多次HASH查找,即采用多HASH查找策略确定对应的目标字段,即采用多HASH查找策略进行第一次HASH查找,并基于中间字段中的HASH表id号查找对应的多HASH规则索引表,然后根据多HASH规则索引表中的HASH表id号从预设映射表中查找到目标字段对应的字段位宽和HASH表宽度;然后将目标字段对应的字段位宽和HASH表宽度替换掉待提 取字段的字段位宽和HASH表宽度,以得到对应的至少一个目标字段。在完成第一次HASH查找之后,将规则索引号执行减一操作,然后重新执行上述的多HASH查找策略,直至将规则索引号减到0为止。In an embodiment, the multiple HASH flag bits can be represented by the first value and the second value. Exemplarily, the first value is 1, and the second value is 0. In the embodiment, when the multi-HASH flag bit is 1, it indicates that the flow classification process performs multiple HASH lookups, that is, the multi-HASH lookup strategy is adopted to determine the corresponding target field, that is, the multi-HASH lookup strategy is used for the first HASH lookup. , And find the corresponding multi-HASH rule index table based on the HASH table id number in the middle field, and then find the field bit width and HASH corresponding to the target field from the preset mapping table according to the HASH table id number in the multi-HASH rule index table Table width; then the field bit width and HASH table width corresponding to the target field are replaced with the field bit width and HASH table width of the field to be extracted to obtain at least one corresponding target field. After completing the first HASH search, the rule index number is reduced by one, and then the above-mentioned multi-HASH search strategy is re-executed until the rule index number is reduced to 0.
在一实施例中,按照至少一个目标字段的优先级顺序,将优先级最高的目标字段作为输出结果进行输出,包括:确定每个目标字段的优先级顺序;将优先级最高的目标字段作为输出结果进行输出。In an embodiment, according to the priority order of at least one target field, outputting the target field with the highest priority as the output result includes: determining the priority order of each target field; and using the target field with the highest priority as the output The result is output.
在实施例中,在从HASH桶中查找到多个目标字段之后,对每个目标字段的优先级进行排序,并将优先级最高的目标字段作为输出结果进行输出。在实施例中,对目标字段的优先级进行排序,指的可以是对于存在多个规则同时生效且需要匹配的情况,对每个规则进行优先级的排序。In the embodiment, after multiple target fields are found from the HASH bucket, the priority of each target field is sorted, and the target field with the highest priority is output as the output result. In the embodiment, sorting the priority of the target field means that for a situation where there are multiple rules that take effect at the same time and need to be matched, the priority of each rule is sorted.
在一实施例中,多规则流分类的实现方法,还包括:采用空闲指针队列和随机存取存储器(Random Access Memory,RAM)结合的方式,对原始输入信息和至少一个输出结果进行存储。In an embodiment, the method for implementing multi-rule flow classification further includes: storing the original input information and at least one output result in a combination of an idle pointer queue and a random access memory (Random Access Memory, RAM).
在实施例中,在对执行多HASH查找策略得到的输出结果进行存储的情况下,可采用空闲指针队列和RAM结合的方式进行存储。在一实施例中,RAM的深度与线程总数有关。在实施例中,RAM的深度可以设置为N,N取决于线程的总数。在实施例中,在存储的过程中,可以存储原始输入信息,也可以存储N个输出结果,对此并不进行限定。In the embodiment, in the case of storing the output result obtained by executing the multi-HASH search strategy, the storage can be carried out in a combination of a free pointer queue and RAM. In one embodiment, the depth of RAM is related to the total number of threads. In an embodiment, the depth of the RAM can be set to N, and N depends on the total number of threads. In the embodiment, during the storage process, the original input information can be stored, or N output results can be stored, which is not limited.
在一实施例中,图2是本申请实施例提供的一种流分类的流程示意图。如图2所示,在流分类处理过程中,包括如下步骤:In an embodiment, FIG. 2 is a schematic flowchart of a flow classification provided by an embodiment of the present application. As shown in Figure 2, the flow classification process includes the following steps:
S210、提取HASH KEY。S210. Extract the HASH KEY.
S220、HASH KEY预处理。S220, HASH KEY preprocessing.
S230、查找HASH桶。S230. Find the HASH bucket.
S240、多HASH结果比较。S240. Comparison of multiple HASH results.
S250、结果输出。S250, the result is output.
在实施例中,HASH KEY指的是上述实施例中的字段。在实施例中,提取HASH KEY的过程中包括:对流分类的处理流程初始化的情况下,根据应用需要使用微码命令进行KEY组合。In the embodiment, HASH KEY refers to the field in the above embodiment. In the embodiment, the process of extracting the HASH KEY includes: in the case of initializing the flow classification processing flow, the microcode command is used to perform KEY combination according to application needs.
HASH KEY预处理的过程中包括:自定义一个SDT表,灵活应对多种HASH输入情况,并针对不同的输入情况灵活地对HASH KEY进行重新处理。在实施例中,根据应用需要定义不同的HASH表宽度、不同的HASH KEY宽度以及不同的结果位宽,从而满足了流分类的多规则仲裁的情况。The process of HASH KEY preprocessing includes: customizing an SDT table, flexibly responding to multiple HASH input conditions, and flexibly reprocessing HASH KEY for different input conditions. In the embodiment, different HASH table widths, different HASH KEY widths, and different result bit widths are defined according to application requirements, thereby satisfying the situation of multi-rule arbitration for flow classification.
查找HASH桶的过程中包括:与HASH KEY预处理部分中的HASH KEY对应,可以灵活地针对不同的HASH KEY位宽进行匹配,并灵活地根据不同的HASH表宽度进行匹配,并输出匹配后的对应结果。The process of finding the HASH bucket includes: Corresponding to the HASH KEY in the HASH KEY preprocessing section, which can flexibly match different HASH KEY bit widths, and flexibly match according to different HASH table widths, and output the matched Corresponding results.
多HASH结果比较的过程中包括:在存在多个规则同时生效且需要匹配的情况下,根据预先配置的优先级顺序选择优先级最高的结果输出。The process of comparing multiple HASH results includes: when there are multiple rules that take effect at the same time and need to be matched, the result with the highest priority is selected for output according to the pre-configured priority order.
在一实施例中,图3是本申请实施例提供的一种流分类中从HASH KEY预处理至多HASH结果比较之间的处理流程图。如图3所示,该处理流程包括如下步骤:In an embodiment, FIG. 3 is a processing flowchart from HASH KEY preprocessing to comparison of HASH results in a flow classification provided in an embodiment of the present application. As shown in Figure 3, the processing flow includes the following steps:
S310、微码检测到流分类流程进入HASH KEY提取阶段,进行KEY提取。S310. The microcode detects that the flow classification process enters the HASH KEY extraction stage, and performs KEY extraction.
S320、微码进行KEY组装,生成原始字段。S320, the microcode performs KEY assembly to generate original fields.
S330、微码组成原始字段后,发起查表请求,并查找SDT表。S330. After the microcode composes the original fields, initiate a table lookup request and look up the SDT table.
S340、读取SDT表之后,结合SDT表中的表项内容和原始字段,生成中间字段。S340. After reading the SDT table, combine the contents of the entries in the SDT table and the original fields to generate intermediate fields.
S350、在中间字段中的多HASH标志位为1的情况下,进行多次HASH查找。S350: When the multi-HASH flag bit in the middle field is 1, perform multiple HASH lookups.
S360、执行第一次HASH查找,并基于KEY中的HASH表id号查找算术逻辑(Arithmetic LoGic,ALG)内部的一个表,并将查找结果替换原始字段中的HASH KEY。S360. Perform the first HASH search, search for a table in Arithmetic LoGic (ALG) based on the HASH table id number in the KEY, and replace the HASH KEY in the original field with the search result.
S370、执行第二次直到最后一次HASH查找,并将HASH KEY中的HASH表id号加1作为索引进行查表,并用查找结果替换原始字段中的HASH KEY。S370. Perform the second until the last HASH lookup, and use the hash table id number in the HASH KEY plus 1 as an index to look up the table, and replace the HASH KEY in the original field with the search result.
S380、采用空闲指针队列和RAM结合的方式,对查找结果进行存储。S380. The search result is stored by using the combination of the idle pointer queue and the RAM.
S390、完成HASH KEY组装之后,送入原有的ALG功能模块进行处理。S390. After completing the HASH KEY assembly, send it to the original ALG function module for processing.
在实施例中,在微码检测到流分类流程进入到HASH KEY提取阶段,开始进行拼接。首先,微码按照原始字段结构进行HASH KEY组装,以生成对应的原始字段。表1是本申请实施例提供的一种原始字段结构示意表。如表1所示,原始字段结构包括:待提取字段、待查找SDT表的地址和当前微码的线程号。In the embodiment, when the microcode detects that the flow classification process enters the HASH KEY extraction stage, the splicing is started. First, the microcode performs HASH KEY assembly according to the original field structure to generate the corresponding original field. Table 1 is a schematic table of an original field structure provided by an embodiment of the present application. As shown in Table 1, the original field structure includes: the field to be extracted, the address of the SDT table to be searched, and the thread number of the current microcode.
表1 一种原始字段结构示意表Table 1 A schematic table of the original field structure
待查找SDT表的地址The address of the SDT table to be looked up 当前微码的线程号Thread number of current microcode 待提取字段Field to be extracted
在实施例中,可采用HASH KEY表示微码根据需要提取的字段,即待提取字段;sdt_num表示待查找SDT表的地址;np_no表示当前微码的线程号。In the embodiment, HASH KEY may be used to indicate the field extracted by the microcode as needed, that is, the field to be extracted; sdt_num indicates the address of the SDT table to be searched; np_no indicates the thread number of the current microcode.
在微码生成原始字段之后,发起查表请求,首先基于sdt_num查找SDT表。 表2是本申请实施例提供的一种SDT表的结构示意表。After the original field is generated by the microcode, a table lookup request is initiated, and the SDT table is first searched based on sdt_num. Table 2 is a schematic table of the structure of an SDT table provided in an embodiment of the present application.
表2 一种SDT表的结构示意表Table 2 A schematic table of the structure of an SDT table
Figure PCTCN2020131891-appb-000001
Figure PCTCN2020131891-appb-000001
在实施例中,可采用multi_hash表示多HASH标志位;multi_table_id表示HASH表号;hash_key_size表示HASH KEY大小标志位;multi_tbl_width表示HASH表宽度标志位。In an embodiment, multi_hash may be used to indicate a multi-HASH flag bit; multi_table_id indicates a HASH table number; hash_key_size indicates a HASH KEY size flag bit; multi_tbl_width indicates a HASH table width flag bit.
示例性地,在multi_hash为0的情况下,表示访问HASH模块的键值长度,HASH键值总共384bit。比如,hash_key_keytype为128bit的情况下支持的最小粒度为1byte,keysize的值范围为1-14,对应的HASH键值长度(以8bit为单位)分别为:000001-1*8bit,000010-2*8bit,001110-14*8bit,其他情况保留;hash_key_keytype为256bit的情况下支持的最小粒度为2byte,keysize的值范围为1-15,对应的HASH键值长度(以16bit为单位)分别为:000001-1*16bit,000010-2*16bit,001111-15*16bit,其他情况保留;hash_key_keytype为384bit的情况下支持的最小粒度为4byte,keysize的值范围为1-12,对应的HASH键值长度(以32bit为单位)分别为:000001-1*32bit,000010-2*32bit,001100-12*32bit,其他情况保留;hash_key_keytype为512bit的情况下支持的最小粒度为4byte,keysize的值范围为1-12,对应的HASH键值长度(以32bit为单位)分别为:000001-1*32bit,000010-2*32bit,001100-12*32bit,其他情况保留。在实施例中,multi_tbl_width表示HASH表宽度标志位,用于存储位宽。key type为2bit,表示该查找对应的HASH表项长度类型为:01-128bit,10-256bit, 11-512bit,00-384bit。Exemplarily, when multi_hash is 0, it indicates the length of the key value for accessing the HASH module, and the total HASH key value is 384 bits. For example, when the hash_key_keytype is 128bit, the minimum supported granularity is 1byte, the value range of keysize is 1-14, and the corresponding HASH key length (in 8bit units) are: 000001-1*8bit, 000010-2*8bit , 001110-14*8bit, reserved for other cases; when the hash_key_keytype is 256bit, the minimum supported granularity is 2byte, the value range of keysize is 1-15, and the corresponding HASH key length (in 16bit units) are: 000001- 1*16bit, 000010-2*16bit, 001111-15*16bit, reserved for other cases; when hash_key_keytype is 384bit, the minimum supported granularity is 4byte, the value range of keysize is 1-12, and the corresponding HASH key length (in 32bit is the unit) respectively: 000001-1*32bit, 000010-2*32bit, 001100-12*32bit, other cases are reserved; when hash_key_keytype is 512bit, the minimum supported granularity is 4byte, and the value range of keysize is 1-12 , The corresponding HASH key value length (in 32bit unit) are respectively: 000001-1*32bit, 000010-2*32bit, 001100-12*32bit, otherwise reserved. In the embodiment, multi_tbl_width represents the HASH table width flag bit, which is used to store the bit width. The key type is 2bit, which means that the length type of the HASH entry corresponding to the search is: 01-128bit, 10-256bit, 11-512bit, 00-384bit.
在读取SDT表之后,结合SDT表中的每个表项内容和HASH KEY进行组装,以生成对应的中间字段。表3是本申请实施例提供的一种中间字段结构的示意表。如表3所示,中间字段结构包括:当前微码的线程号、多HASH标志位、HASH表号、HASH KEY大小标志位、HASH表宽度标志位和待提取字段。After reading the SDT table, combine the contents of each entry in the SDT table and the HASH KEY to assemble to generate the corresponding middle field. Table 3 is a schematic table of an intermediate field structure provided in an embodiment of the present application. As shown in Table 3, the intermediate field structure includes: the thread number of the current microcode, multiple hash flags, hash table number, hash key size flags, hash table width flags, and fields to be extracted.
表3 一种中间字段结构的示意表Table 3 Schematic table of an intermediate field structure
np_nonp_no
multi_hashmulti_hash
multi_table_idmulti_table_id
hash_key_sizehash_key_size
multi_tbl_widthmulti_tbl_width
HASH KEYHASH KEY
在HASH处理过程中,先通过预处理模块进行提前分流,在中间字段中的multi_hash为0的情况下,则执行基本的HASH通路(即单HASH查找策略),但是需要在高位新增8bit信息,即1bit multi hash+7bit multi hash index;在中间字段中的multi hash为1的情况下,则表示需要进行多次HASH查找,执行多HASH通路(即多HASH查找策略)。In the HASH processing process, the pre-processing module is used to pre-shunt. When the multi_hash in the middle field is 0, the basic HASH path (that is, the single HASH search strategy) is executed, but it is necessary to add 8bit information in the high position. That is, 1bit multi hash+7bit multi hash index; when the multi hash in the middle field is 1, it means that multiple hash lookups need to be performed and multiple hash paths (ie, multiple hash lookup strategies) are required.
在采用多HASH通路进行第一次HASH查找的情况下,先基于中间字段中的hash_table_id查找ALG内部的一个表。表4是本申请实施例提供的一种多HASH规则索引表。In the case of using multiple HASH channels for the first HASH lookup, first look up a table inside the ALG based on the hash_table_id in the middle field. Table 4 is an index table of multiple HASH rules provided in an embodiment of the present application.
表4 一种多HASH规则索引表Table 4 A multi-HASH rule index table
Figure PCTCN2020131891-appb-000002
Figure PCTCN2020131891-appb-000002
表5是本申请实施例提供的一种hash_table_id配置表。如表5所示,包括:HASH表宽度、HASH KEY大小和HASH KEY位置。 表5 一种hash_table_id配置表Table 5 is a hash_table_id configuration table provided by an embodiment of the present application. As shown in Table 5, it includes: HASH table width, HASH KEY size, and HASH KEY location. Table 5 A configuration table of hash_table_id
Figure PCTCN2020131891-appb-000003
Figure PCTCN2020131891-appb-000003
Figure PCTCN2020131891-appb-000004
Figure PCTCN2020131891-appb-000004
将查SDT表得到的hash_table_id、hash_key_size、hash_table_width依次替换原始key中的hash_key_size、hash_key_type。根据查表得到的hash_key_size、hash_key_location、hash_key_mask重新生成HASH KEY,参数含义如上表所示,举例,在hash_key_size设置为64bit,hash_key_location设置为5的情况下,hash_key(504bit)为{320’b0,(HASH_KEY[383:320]&hash_key_mask[63:0],120’b0}。Replace the hash_key_size and hash_key_type in the original key with the hash_table_id, hash_key_size, and hash_table_width obtained by checking the SDT table in turn. Regenerate the HASH KEY according to the hash_key_size, hash_key_location, and hash_key_mask obtained by looking up the table. The meaning of the parameters is as shown in the table above. For example, when hash_key_size is set to 64bit and hash_key_location is set to 5, hash_key(504bit) is {320'b0,(HASH_KEY [383:320]&hash_key_mask[63:0], 120'b0}.
在进行第二次直到最后一次HASH查找的情况下,以表4的hash_mul_next_addr的为索引,查找表4,其他流程同S350。每查一次HASH,表4中读到的multi_num就减一,当减到0表示当前处理的多hash_key已经申请结束,开始下一个多hash_key的申请。In the case of performing the second until the last HASH lookup, use hash_mul_next_addr in Table 4 as the index to look up Table 4, and the other processes are the same as S350. Each time the HASH is checked, the multi_num read in Table 4 is reduced by one. When it is reduced to 0, it means that the current multi-hash_key application has ended, and the next multi-hash_key application is started.
另一方面,预处理模块对于multi_hash拉高的key由于并非立刻返回结果,需要进行存储,存储采用空闲指针队列+RAM的方式,RAM的深度设置为N(N取决于线程的总数)。存储不仅是存储原始输入的信号,以及存储N个输出结果(bit位宽根据应用自行确定,其中最高位为hit)。在实施例中,将输出结果的次高5bit作为优先级仲裁使用。(在HASH表项中为紧跟key的最高5bit,在全部结果都读取完之后,取最高优先级对应的结果)还需要一个用于存储待处理指针的先进先出(First In First Out,FIFO)存储器(即存储的是multi_index)。N个KEY之间采取先进先出的原则,一个复制完之后复制下一个。On the other hand, the preprocessing module does not return the result immediately for the key raised by multi_hash, so it needs to be stored. The storage adopts the free pointer queue + RAM, and the depth of RAM is set to N (N depends on the total number of threads). Storage is not only storing the original input signal, but also storing N output results (the bit width is determined by the application, and the highest bit is hit). In the embodiment, the next highest 5 bits of the output result are used as priority arbitration. (In the HASH table entry, it is the highest 5bit immediately following the key. After all the results are read, the result corresponding to the highest priority is taken.) A first-in-first-out (First In First Out) for storing the pointer to be processed is also required. FIFO) memory (that is, multi_index is stored). The first-in-first-out principle is adopted between N KEYs, and the next one is copied after one is copied.
复制次数基于表4中的multi_num参数确定,每复制一次,该参数减一,直到减到0,表示复制结束,开始下一次复制。将key组装好之后,送入基本HASH的功能模块,对于多HASH的key和原始通路的key之间的调度,目前采用轮询(Round-Robin,RR)的方式,两者同等优先级,基本HASH功能模块进行查找后,返回对应输出结果的相关参数。采用本技术方案,不仅可以配合微码的固化部分,使得提取字段固定,更重要的是大大降低了在业务种类复杂时ONU的流分类功能查表时延,所设计的能与微码灵活配套的HASH查找方案,例如方案中的可重构的HASH条目结构,提高了RAM的利用率,减少了NP的线程数,降低了芯片成本。The number of replications is determined based on the multi_num parameter in Table 4. For each replication, this parameter is reduced by one until it is reduced to 0, which means that the replication is over and the next replication is started. After the keys are assembled, they are sent to the basic HASH functional module. For the scheduling between the keys of multiple HASH and the keys of the original path, the round-robin (RR) method is currently used, and the two have the same priority. After the HASH function module searches, it returns the relevant parameters corresponding to the output result. Using this technical solution can not only cooperate with the solidification part of the microcode to make the extraction field fixed, but more importantly, greatly reduce the time delay of the ONU's flow classification function look-up table when the business type is complex, and the design can be flexibly matched with the microcode. The HASH search scheme, such as the reconfigurable HASH entry structure in the scheme, improves the utilization of RAM, reduces the number of threads of NP, and reduces the cost of the chip.
图4是本申请实施例提供的一种HASH条目结构示意图。如图4所示,HASH 条目结构包括:条目有效标志位(即valid)、key类型标志位(key_type)、HASH表id(即table_id)、业务键值(即key)和输出结果(即result)。Fig. 4 is a schematic diagram of a HASH entry structure provided by an embodiment of the present application. As shown in Figure 4, the HASH entry structure includes: entry valid flag (ie valid), key type flag (key_type), HASH table id (ie table_id), business key value (ie key) and output result (ie result) .
在实施例中,可定义valid为0时,当前条目为无效HASH条目;vaild为1时,当前条目有效。key_type定义如下:key_type为00时,表示key类型为无效;key_type为01时,表示key类型为128bit;key_type为10时,表示key类型为256bit;key_type为11时,表示key类型为512bit。table_id定义如下:0-31,表示32张HASH表。key表示用户自定义的业务键值,长度必须为n*8bit(n=1,2,3……48),最大业务键值长度为384bit,n在[0:48]之间。result为用户自定义的结果数据,最高1bit的no_result位预留给芯片硬件,用以指示微码查HASH是否命中(比如,0表示命中,1表示未命中)。实际返回给微码的result的长度由SDT属性中的rsp_mode决定,当条目中实际存放的result长度大于rsp_mode时,返回给微码时数据被截断,反之,result的低位采用0补齐至rsp_mode位宽。In the embodiment, it can be defined that when valid is 0, the current entry is an invalid HASH entry; when vaild is 1, the current entry is valid. The definition of key_type is as follows: when key_type is 00, it means the key type is invalid; when key_type is 01, it means the key type is 128bit; when key_type is 10, it means the key type is 256bit; when key_type is 11, it means the key type is 512bit. The table_id is defined as follows: 0-31, which means 32 HASH tables. key represents the user-defined business key value, the length must be n*8bit (n=1, 2, 3……48), the maximum business key value length is 384bit, and n is between [0:48]. Result is user-defined result data, the highest 1bit no_result bit is reserved for chip hardware to instruct the microcode to check whether the HASH is hit (for example, 0 means hit, 1 means miss). The length of the result actually returned to the microcode is determined by the rsp_mode in the SDT attribute. When the length of the result actually stored in the entry is greater than rsp_mode, the data is truncated when it is returned to the microcode. On the contrary, the low bit of the result is filled with 0 to the rsp_mode bit width.
在一实施例中,以执行两次HASH查找为例,对多规则流分类的流程进行说明。图5是本申请实施例提供的一种扩展端口获取条目的流程图。如图5所示,本流程包括如下步骤:In an embodiment, taking two HASH lookups as an example, the process of multi-rule flow classification is described. Fig. 5 is a flowchart of an expansion port obtaining entry provided by an embodiment of the present application. As shown in Figure 5, this process includes the following steps:
S410、HASH请求输入。S410, HASH request input.
S420、HASH请求基于HASH表宽度或HASH KEY大小截取有效的key,并和HASH表id号进行HASH计算。S420. The HASH request intercepts a valid key based on the width of the HASH table or the size of the HASH KEY, and performs HASH calculation with the ID number of the HASH table.
S440、HASH计算得到HASH地址之后,从HASH桶中读取N bit数据。S440. After the hash address is obtained by the hash calculation, N bits of data are read from the hash bucket.
S450、在存在匹配条目的情况下,根据条目位宽得到结果在条目中所在的位置。S450. In the case that there is a matching entry, obtain the position of the result in the entry according to the bit width of the entry.
图6是本申请实施例提供的一种HASH条目可重构结构示意图。在实施例中,在HASH请求输入时,可包括:np_no、multi_hash_index、multi_hash、multi_table_id、hash_key_size和multi_tbl_width。然后,HASH请求基于multi_tbl_width或者hash_key_size截取有效的key,然后加上multi_table_id进行hash计算,将该hash计算的步骤执行两次。然后hash计算得到hash地址后,从hash桶中读取N bit数据。示例性地,以N为512,hash匹配条目的位宽为128bit为例,判断[510:509]bit是否为128bit的取值,如果是,则用[511:384]与请求的128bit进行匹配,同时判断[382:381]是否为128bit的取值。如果是,则用[383:256]与请求的128bit进行匹配,依次类推,对[255:128]、[127:0]与请求的128bit进行匹配,可重构结构参见图6所示。Fig. 6 is a schematic diagram of a reconfigurable structure of a HASH entry provided by an embodiment of the present application. In an embodiment, the HASH request input may include: np_no, multi_hash_index, multi_hash, multi_table_id, hash_key_size, and multi_tbl_width. Then, the HASH request intercepts a valid key based on multi_tbl_width or hash_key_size, and then adds multi_table_id for hash calculation, and executes the hash calculation step twice. Then, after the hash address is calculated by the hash, N bits of data are read from the hash bucket. Exemplarily, taking N as 512 and the bit width of the hash matching entry as 128bit as an example, judge whether [510:509]bit is the value of 128bit, and if so, use [511:384] to match the requested 128bit , And at the same time determine whether [382:381] is a 128bit value. If so, use [383:256] to match the requested 128bit, and so on, match [255:128], [127:0] with the requested 128bit, see Figure 6 for the reconfigurable structure.
在一实施例中,以配置3层报文(即L3)的访问控制列表(Access Control  List,ACL)规则为例,对多规则流分类的实现过程进行说明。In an embodiment, the configuration of an access control list (Access Control List, ACL) rule for Layer 3 packets (ie, L3) is taken as an example to describe the implementation process of multi-rule flow classification.
对于L3报文,可包括:7元组,6元组,5元组等情况。在实施例中,以7元组为例,对多规则流分类的实现过程进行说明。在KEY提取时,先将7元组的所有参数全部提取拼接成key(即原始字段),并且该KEY位宽在64~128之间。软件预先配置好一个sdt_num与这个多hash规则对应;然后配置sdt_num对应的sdt表,参数依次说明如下:multi_hash:设置为1,表示多hash查找使能;hash table width:在此无意义;multi_hash_addr:(即原Hash key size+hash table id)在此表示多hash查找的首地址。一实现方式中,根据当前使用情况进行预留,比如先预留8次多hash查找,首地址配置为0,下一个多hash的首地址则设置为8,这种情况的话可能存在浪费。如果软件实现方便,在当前用到多少次多hash规则索引表,该值就配为已使用的次数值,比如一开始没有使用,则配置为0,第二次配置时,该参数设置为1,也就是下一个空闲指针的位置。For L3 messages, it can include: 7-tuple, 6-tuple, 5-tuple, etc. In the embodiment, the 7-tuple is taken as an example to describe the implementation process of multi-rule flow classification. When KEY is extracted, all the parameters of the 7-tuple are first extracted and spliced into a key (or original field), and the KEY bit width is between 64 and 128. The software pre-configures an sdt_num corresponding to this multi-hash rule; then configures the sdt table corresponding to sdt_num, the parameters are described in sequence as follows: multi_hash: set to 1, indicating that multi-hash search is enabled; hash table width: meaningless here; multi_hash_addr: (That is, the original hash key size+hash table id) here means the first address of the multi-hash search. In one implementation, reservation is made according to the current usage, for example, 8 multi-hash lookups are reserved first, the first address is configured to be 0, and the first address of the next multi-hash is set to 8. In this case, there may be waste. If the software is easy to implement, the number of times the multi-hash rule index table is currently used, the value is configured as the value of the number of times used, for example, if it is not used at the beginning, it is configured to 0, and the parameter is set to 1 in the second configuration. , Which is the position of the next free pointer.
然后,配置多HASH规则索引表,首地址为multi_hash_addr。在多HASH规则索引表中,multi_num:该参数如表4所述,只有首地址有效,比如当前只是进行一次7元组查找,那么该参数配置为1,如果后续新增了一个三元组查找,那么该参数需要修改为2。Then, configure the multi-hash rule index table, the first address is multi_hash_addr. In the multi-HASH rule index table, multi_num: This parameter is as described in Table 4, and only the first address is valid. For example, currently only a 7-tuple search is performed, then this parameter is configured to 1, if a subsequent triple search is added , Then this parameter needs to be modified to 2.
hash_id:hash_id和hash_table_id是一起配置的,对应为真正的业务表号,比如当前的7元组业务,如果其他端口已经设置了7元组业务与当前提取条件完全相同,则当前设置的hash_id和hash_table_id与之前的hash_id和hash_table_id匹配,从而节省业务表号;hash_table_id:同上;hash_mul_next_addr:如果剩余需要复制的次数的值大于1,那么hash_mul_next_addr就有意义,该参数与sdt表中的multi_hash_addr配置思想类似,可采用下述两种配置方式来实现。一种实现方式为:预留+递增法,采用该实现方式时,表示每次使用multi_hash_addr后直接预留N个位置(N小于等于8),hash_mul_next_addr=multi_hash_addr+当前复制次数-1,举例,比如新增了一个三元组规则,那么相当于当前复制次数为2(原来只有一次7元组规则),hash_mul_next_addr=multi_hash_addr+2-1;一种实现方式为:空闲指针法,采用该实现方式时,软件记录当前未使用的多hash规则索引表的最小编号的地址。比如一开始全部未使用,那么空闲指针就用0,如果使用了一次,第二次使用时,空闲指针就用1,依次类推。hash_id: hash_id and hash_table_id are configured together, corresponding to the real business table number, such as the current 7-tuple business, if the 7-tuple business has been set on other ports and the current extraction conditions are exactly the same, the currently set hash_id and hash_table_id Match with the previous hash_id and hash_table_id to save the business table number; hash_table_id: Same as above; hash_mul_next_addr: If the value of the remaining number of replications is greater than 1, then hash_mul_next_addr is meaningful. This parameter is similar to the multi_hash_addr configuration idea in the sdt table. Use the following two configuration methods to achieve. One implementation method is: reservation + increment method. When this implementation method is adopted, it means that N positions (N is less than or equal to 8) are directly reserved after each use of multi_hash_addr, hash_mul_next_addr = multi_hash_addr + current copy times -1, for example, such as new A triple rule is added, then it is equivalent to the current number of copies is 2 (there is only one 7-tuple rule), hash_mul_next_addr=multi_hash_addr+2-1; one implementation is: idle pointer method, when this implementation is adopted, The software records the address of the smallest number of the currently unused multi-hash rule index table. For example, if all of them are not used at the beginning, then the free pointer will use 0, if it is used once, the free pointer will use 1 when it is used for the second time, and so on.
然后,配置hash_table_id配置表。在实施例中,hash_table_width和表项位宽对应,比如当前key长度为64~128之间,并且结果通过级联获取,此时该参数配置为01,即128bit;hash_key_size:表示当前key长度为64~128,在key长度为128bit的位宽时,hash_key_size的值为0,如果key长度为64bit,那么 hash_key_size的值为8;hash_key_location:当前总体位宽只用了不到128bit,并且key位宽也是128bit,则选0,其他更多取值说明见表5;hash_key_mask:当前总体位宽只用了不到128bit,并且key位宽也是128bit,则mask位为[127:0]有效,并且根据当前实际7元组的位宽进行真实地截取,比如说7元组使用了低90bit,那么mask[89:0]配置为1,[127:90]配置为0。Then, configure the hash_table_id configuration table. In the embodiment, hash_table_width corresponds to the bit width of the table entry. For example, the current key length is between 64 and 128, and the result is obtained by cascading. At this time, the parameter is configured to 01, which is 128bit; hash_key_size: indicates that the current key length is 64 ~128, when the key length is 128bit, the value of hash_key_size is 0, if the key length is 64bit, then the value of hash_key_size is 8; hash_key_location: The current overall bit width is less than 128bit, and the key bit width is also 128bit, select 0, see Table 5 for other more value descriptions; hash_key_mask: The current overall bit width is only used less than 128bit, and the key bit width is also 128bit, then the mask bit [127:0] is valid, and according to the current The actual bit width of the 7-tuple is actually intercepted. For example, if the 7-tuple uses the lower 90 bits, then mask[89:0] is configured as 1, and [127:90] is configured as 0.
在一实施例中,当前ONU工作的情况下,已经在512bit RAM的位宽中配置了第一个128bit的条目,占据了[511:384]bit,当新的条目又HASH到同一个地址时,配置了第二个128bit的条目,占据了[383:256]bit。当又有条目HASH到同一个地址时,并且需要256bit,此时可配置在[255:0]。In one embodiment, when the ONU is currently working, the first 128-bit entry has been configured in the bit width of the 512-bit RAM, occupying [511:384] bits. When the new entry is hashed to the same address again , The second 128bit entry is configured, occupying [383:256]bit. When there is another item HASH to the same address, and 256bit is required, it can be configured in [255:0] at this time.
图7是本申请实施例提供的一种多规则流分类的实现装置的结构框图。本实施例应用于降低NP进行流分类规则的查表延时的情况。如图7所示,本实施例中的装置包括:第一生成模块510、第二生成模块520、查找模块530和输出模块540。Fig. 7 is a structural block diagram of a device for implementing multi-rule flow classification provided by an embodiment of the present application. This embodiment is applied to reduce the delay in table lookup of the flow classification rule performed by the NP. As shown in FIG. 7, the device in this embodiment includes: a first generation module 510, a second generation module 520, a search module 530, and an output module 540.
第一生成模块510,设置为在检测到哈希HASH查找指令触发的情况下,基于原始字段结构,并根据原始输入信息中的待提取字段生成对应的原始字段;第二生成模块520,设置为根据原始字段和预先配置的系统设备表SDT中的表项内容,生成对应的中间字段;查找模块530,设置为按照中间字段从预设HASH桶中查找与待提取字段的位宽和HASH表宽度匹配的至少一个目标字段;输出模块540,设置为按照至少一个目标字段的优先级顺序,将优先级最高的目标字段作为输出结果进行输出。The first generation module 510 is configured to generate corresponding original fields based on the original field structure and according to the fields to be extracted in the original input information when the hash HASH search instruction trigger is detected; the second generation module 520 is configured to According to the original field and the content of the entries in the pre-configured system device table SDT, the corresponding intermediate field is generated; the search module 530 is set to search the preset HASH bucket according to the intermediate field and the bit width and the width of the HASH table of the field to be extracted At least one matched target field; the output module 540 is configured to output the target field with the highest priority as the output result according to the priority order of the at least one target field.
本实施例提供的多规则流分类的实现装置设置为实现图1所示实施例的多规则流分类的实现方法,本实施例提供的多规则流分类的实现装置实现原理和技术效果类似,此处不再赘述。The device for implementing multi-rule flow classification provided in this embodiment is configured to implement the method for implementing multi-rule flow classification in the embodiment shown in FIG. 1. The implementation principle and technical effect of the device for implementing multi-rule flow classification provided in this embodiment are similar. I won't repeat it here.
在一实施例中,第一生成模块510,是设置为按照原始字段结构,将待查找SDT表的地址、当前微码的线程号和原始输入信息中的待提取字段进行组合,生成对应的原始字段。In one embodiment, the first generation module 510 is configured to combine the address of the SDT table to be searched, the thread number of the current microcode, and the field to be extracted in the original input information according to the original field structure to generate the corresponding original field structure. Field.
在一实施例中,第二生成模块520,包括:读取单元,设置为根据原始字段中的待查找SDT表的地址读取预先配置的SDT表,得到对应的表项内容;第一生成单元,设置为基于中间字段结构,对表项内容、原始字段中的当前微码的线程号和待提取字段进行组合,生成对应的中间字段。In an embodiment, the second generating module 520 includes: a reading unit configured to read the pre-configured SDT table according to the address of the SDT table to be looked up in the original field to obtain the corresponding table item content; the first generating unit , It is set to combine the content of the table entry, the thread number of the current microcode in the original field, and the field to be extracted based on the structure of the intermediate field to generate the corresponding intermediate field.
在一实施例中,多规则流分类的实现装置,还包括:确定模块,设置为在按照中间字段从预设HASH桶中查找与待提取字段的位宽和HASH表宽度匹配的至少一个目标字段之前,根据中间字段中的多HASH标志位确定对应的HASH 查找策略,多HASH标志位用于表示当前多HASH查找请求的HASH规则数目,HASH查找策略包括多HASH查找策略。In an embodiment, the device for implementing multi-rule flow classification further includes: a determining module configured to search for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket according to the intermediate field Previously, the corresponding HASH search strategy was determined according to the multi-HASH flag bit in the middle field. The multi-HASH flag bit is used to indicate the number of hash rules for the current multi-HASH search request. The hash search strategy includes a multi-HASH search strategy.
在一实施例中,在多HASH标志位为第一数值的情况下,查找模块530,包括:查找单元,设置为基于多HASH查找策略,并按照中间字段中的HASH表id号查找对应的多HASH规则索引表;第一确定单元,设置为根据多HASH规则索引表中的HASH表id号从所述预设HASH桶中确定至少一个目标字段对应的字段位宽和HASH表宽度;第二生成单元,设置为根据字段位宽和HASH表宽度生成对应的至少一个目标字段。In one embodiment, when the multi-HASH flag bit is the first value, the search module 530 includes: a search unit, configured to search based on a multi-HASH search strategy, and search for the corresponding multi-HASH table ID according to the HASH table id number in the middle field. HASH rule index table; a first determining unit configured to determine the field bit width and HASH table width corresponding to at least one target field from the preset HASH bucket according to the HASH table id number in the multi-HASH rule index table; second generation The unit is set to generate at least one corresponding target field according to the bit width of the field and the width of the HASH table.
在一实施例中,输出模块540,包括:第二确定单元,设置为确定每个目标字段的优先级顺序;输出单元,设置为将优先级最高的目标字段作为输出结果进行输出。In an embodiment, the output module 540 includes: a second determining unit configured to determine the priority order of each target field; and an output unit configured to output the target field with the highest priority as an output result.
在一实施例中,多规则流分类的实现装置,还包括:存储模块,设置为采用空闲指针队列和RAM结合的方式,对原始输入信息和至少一个输出结果进行存储。In one embodiment, the device for implementing multi-rule flow classification further includes: a storage module configured to store the original input information and at least one output result in a combination of an idle pointer queue and RAM.
在一实施例中,RAM的深度与线程总数有关。In one embodiment, the depth of RAM is related to the total number of threads.
图8是本申请实施例提供的一种设备的结构示意图。如图8所示,本申请提供的设备,包括:处理器610和存储器620。该设备中处理器610的数量可以是一个或者多个,图8中以一个处理器610为例。该设备中存储器620的数量可以是一个或者多个,图8中以一个存储器620为例。该设备的处理器610和存储器620以通过总线或者其他方式连接,图8中以通过总线连接为例。在该实施例中,该设备为光网络终端。Fig. 8 is a schematic structural diagram of a device provided by an embodiment of the present application. As shown in FIG. 8, the device provided by the present application includes: a processor 610 and a memory 620. The number of processors 610 in the device may be one or more. In FIG. 8, one processor 610 is taken as an example. The number of memories 620 in the device may be one or more. In FIG. 8, one memory 620 is taken as an example. The processor 610 and the memory 620 of the device are connected through a bus or in other ways. In FIG. 8, the connection through a bus is taken as an example. In this embodiment, the device is an optical network terminal.
存储器620作为一种计算机可读存储介质,可设置为存储软件程序、计算机可执行程序以及模块,如本申请任意实施例的设备对应的程序指令/模块(例如,多规则流分类的实现装置中的第一生成模块、第二生成模块、查找模块和输出模块)。存储器620可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据设备的使用所创建的数据等。此外,存储器620可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储器620可进一步包括相对于处理器610远程设置的存储器,这些远程存储器可以通过网络连接至设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。As a computer-readable storage medium, the memory 620 can be configured to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the device of any embodiment of the present application (for example, in the device for implementing multiple rule flow classification) The first generation module, the second generation module, the search module and the output module). The memory 620 may include a program storage area and a data storage area. The program storage area may store an operating system and an application program required by at least one function; the data storage area may store data created according to the use of the device, and the like. In addition, the memory 620 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some examples, the memory 620 may further include a memory remotely provided with respect to the processor 610, and these remote memories may be connected to the device through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
上述提供的设备可设置为执行上述任意实施例提供的多规则流分类的实现方法,具备相应的功能和效果。The above-provided device can be configured to implement the multi-rule flow classification implementation method provided by any of the above-mentioned embodiments, and has corresponding functions and effects.
本申请实施例还提供一种包含计算机可执行指令的存储介质,计算机可执行指令在由计算机处理器执行时用于执行一种多规则流分类的实现方法,该方法包括:在检测到哈希HASH查找指令触发的情况下,基于原始字段结构,并根据原始输入信息中的待提取字段生成对应的原始字段;根据原始字段和预先配置的系统设备表SDT中的表项内容,生成对应的中间字段;按照中间字段从预设HASH桶中查找与待提取字段的位宽和HASH表宽度匹配的至少一个目标字段;按照至少一个目标字段的优先级顺序,将优先级最高的目标字段作为输出结果进行输出。The embodiment of the present application also provides a storage medium containing computer-executable instructions. When the computer-executable instructions are executed by a computer processor, they are used to implement a method for implementing multi-rule flow classification. The method includes: When the HASH lookup command is triggered, the corresponding original field is generated based on the original field structure and the field to be extracted in the original input information; the corresponding intermediate field is generated according to the original field and the content of the entry in the pre-configured system equipment table SDT Field; according to the intermediate field, find at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket; according to the priority order of at least one target field, the target field with the highest priority is used as the output result Perform output.
本领域内的技术人员应明白,术语用户设备涵盖任何适合类型的无线用户设备,例如移动电话、便携数据处理装置、便携网络浏览器或车载移动台。Those skilled in the art should understand that the term user equipment encompasses any suitable type of wireless user equipment, such as a mobile phone, a portable data processing device, a portable web browser, or a vehicle-mounted mobile station.
本申请的多种实施例可以在硬件或专用电路、软件、逻辑或其任何组合中实现。例如,一些方面可以被实现在硬件中,而其它方面可以被实现在可以被控制器、微处理器或其它计算装置执行的固件或软件中,尽管本申请不限于此。The various embodiments of the present application can be implemented in hardware or dedicated circuits, software, logic or any combination thereof. For example, some aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device, although the present application is not limited thereto.
本申请的实施例可以通过移动装置的数据处理器执行计算机程序指令来实现,例如在处理器实体中,或者通过硬件,或者通过软件和硬件的组合。计算机程序指令可以是汇编指令、指令集架构(Instruction Set Architecture,ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码。The embodiments of the present application may be implemented by executing computer program instructions by a data processor of a mobile device, for example, in a processor entity, or by hardware, or by a combination of software and hardware. Computer program instructions can be assembly instructions, Instruction Set Architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or written in any combination of one or more programming languages Source code or object code.
本申请附图中的任何逻辑流程的框图可以表示程序步骤,或者可以表示相互连接的逻辑电路、模块和功能,或者可以表示程序步骤与逻辑电路、模块和功能的组合。计算机程序可以存储在存储器上。存储器可以具有任何适合于本地技术环境的类型并且可以使用任何适合的数据存储技术实现,例如但不限于只读存储器(Read-Only Memory,ROM)、随机访问存储器(Random Access Memory,RAM)、光存储器装置和系统(数码多功能光碟(Digital Video Disc,DVD)或光盘(Compact Disk,CD))等。计算机可读介质可以包括非瞬时性存储介质。数据处理器可以是任何适合于本地技术环境的类型,例如但不限于通用计算机、专用计算机、微处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑器件(Field-Programmable Gate Array,FPGA)以及基于多核处理器架构的处理器。The block diagram of any logic flow in the drawings of the present application may represent program steps, or may represent interconnected logic circuits, modules, and functions, or may represent a combination of program steps and logic circuits, modules, and functions. The computer program can be stored on the memory. The memory can be of any type suitable for the local technical environment and can be implemented using any suitable data storage technology, such as but not limited to read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), optical Memory devices and systems (Digital Video Disc (DVD) or Compact Disk (CD)), etc. Computer-readable media may include non-transitory storage media. The data processor can be any type suitable for the local technical environment, such as but not limited to general-purpose computers, special-purpose computers, microprocessors, digital signal processors (Digital Signal Processors, DSP), application specific integrated circuits (ASICs) ), programmable logic devices (Field-Programmable Gate Array, FPGA), and processors based on multi-core processor architecture.

Claims (10)

  1. 一种多规则流分类的实现方法,包括:A method for implementing multi-rule flow classification includes:
    在检测到哈希HASH查找指令触发的情况下,基于原始字段结构,并根据原始输入信息中的待提取字段生成对应的原始字段;In the case of detecting that the hash HASH search instruction is triggered, the corresponding original field is generated based on the original field structure and the field to be extracted in the original input information;
    根据所述原始字段和预先配置的系统设备表SDT中的表项内容,生成对应的中间字段;Generate corresponding intermediate fields according to the original fields and the contents of the entries in the pre-configured system equipment table SDT;
    按照所述中间字段从预设HASH桶中查找与所述待提取字段的位宽和HASH表宽度匹配的至少一个目标字段;Searching for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from the preset HASH bucket according to the intermediate field;
    按照所述至少一个目标字段的优先级顺序,将优先级最高的目标字段作为输出结果进行输出。According to the priority order of the at least one target field, the target field with the highest priority is output as the output result.
  2. 根据权利要求1所述的方法,其中,所述基于原始字段结构,并根据原始输入信息中的待提取字段生成对应的原始字段,包括:The method according to claim 1, wherein the generating the corresponding original field based on the original field structure and according to the field to be extracted in the original input information comprises:
    按照所述原始字段结构,将待查找SDT表的地址、当前微码的线程号和所述原始输入信息中的待提取字段进行组合,生成对应的原始字段。According to the original field structure, the address of the SDT table to be searched, the thread number of the current microcode, and the field to be extracted in the original input information are combined to generate the corresponding original field.
  3. 根据权利要求1所述的方法,其中,所述根据所述原始字段和预先配置的系统设备表SDT中的表项内容,生成对应的中间字段,包括:The method according to claim 1, wherein the generating the corresponding intermediate field according to the original field and the entry content in the pre-configured system equipment table SDT comprises:
    根据所述原始字段中的待查找SDT表的地址读取所述预先配置的SDT表,得到对应的表项内容;Read the pre-configured SDT table according to the address of the SDT table to be searched in the original field to obtain the corresponding table entry content;
    基于中间字段结构,对所述表项内容、所述原始字段中的当前微码的线程号和待提取字段进行组合,生成对应的中间字段。Based on the intermediate field structure, the entry content, the thread number of the current microcode in the original field, and the field to be extracted are combined to generate a corresponding intermediate field.
  4. 根据权利要求1所述的方法,在所述按照所述中间字段从预设HASH桶中查找与所述待提取字段的位宽和HASH表宽度匹配的至少一个目标字段之前,还包括:The method according to claim 1, before said searching for at least one target field matching the bit width of the field to be extracted and the width of the HASH table from a preset HASH bucket according to the intermediate field, further comprising:
    根据所述中间字段中的多HASH标志位确定对应的HASH查找策略,所述多HASH标志位用于表示当前多HASH查找请求的HASH规则数目,所述HASH查找策略包括多HASH查找策略。The corresponding HASH search strategy is determined according to the multiple HASH flag bits in the middle field, the multiple HASH flag bits are used to indicate the number of hash rules of the current multiple HASH search request, and the HASH search strategy includes a multiple HASH search strategy.
  5. 根据权利要求4所述的方法,其中,在所述多HASH标志位为第一数值的情况下,所述按照所述中间字段从预设HASH桶中查找与所述待提取字段的位宽和HASH表宽度匹配的至少一个目标字段,包括:The method according to claim 4, wherein, in the case that the multi-HASH flag bit is the first value, the search for the sum of the bit width of the field to be extracted from a preset HASH bucket according to the intermediate field At least one target field that matches the width of the HASH table includes:
    基于所述多HASH查找策略,并按照所述中间字段中的HASH表身份标识id号查找对应的多HASH规则索引表;Based on the multi-HASH search strategy, and search the corresponding multi-HASH rule index table according to the HASH table identification id number in the intermediate field;
    根据所述多HASH规则索引表中的HASH表id号从所述预设HASH桶中 确定所述至少一个目标字段对应的字段位宽和HASH表宽度;Determining the field bit width and the HASH table width corresponding to the at least one target field from the preset HASH bucket according to the HASH table id number in the multiple HASH rule index table;
    根据所述字段位宽和所述HASH表宽度生成所述至少一个目标字段。The at least one target field is generated according to the bit width of the field and the width of the HASH table.
  6. 根据权利要求1所述的方法,其中,所述按照所述至少一个目标字段的优先级顺序,将优先级最高的目标字段作为输出结果进行输出,包括:The method according to claim 1, wherein the outputting the target field with the highest priority as the output result according to the priority order of the at least one target field comprises:
    确定每个目标字段的优先级顺序;Determine the priority order of each target field;
    将所述优先级最高的目标字段作为输出结果进行输出。The target field with the highest priority is output as the output result.
  7. 根据权利要求1-6任一所述的方法,还包括:The method according to any one of claims 1-6, further comprising:
    采用空闲指针队列和随机存取存储器RAM结合的方式,对原始输入信息和至少一个输出结果进行存储。The free pointer queue and the random access memory RAM are combined to store the original input information and at least one output result.
  8. 根据权利要求7所述的方法,其中,所述RAM的深度与线程总数有关。The method according to claim 7, wherein the depth of the RAM is related to the total number of threads.
  9. 一种设备,包括:存储器,以及,至少一个处理器;A device, including: a memory, and at least one processor;
    存储器,设置为存储至少一个程序;Memory, set to store at least one program;
    当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-8任一项所述的方法。When the at least one program is executed by the at least one processor, the at least one processor is enabled to implement the method according to any one of claims 1-8.
  10. 一种存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-8任一项所述的方法。A storage medium storing a computer program, which implements the method of any one of claims 1-8 when the computer program is executed by a processor.
PCT/CN2020/131891 2019-11-27 2020-11-26 Method for achieving multi-rule flow classification, device, and storage medium WO2021104393A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911183380.6A CN112866139A (en) 2019-11-27 2019-11-27 Method, equipment and storage medium for realizing multi-rule flow classification
CN201911183380.6 2019-11-27

Publications (1)

Publication Number Publication Date
WO2021104393A1 true WO2021104393A1 (en) 2021-06-03

Family

ID=75985768

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/131891 WO2021104393A1 (en) 2019-11-27 2020-11-26 Method for achieving multi-rule flow classification, device, and storage medium

Country Status (2)

Country Link
CN (1) CN112866139A (en)
WO (1) WO2021104393A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114205115A (en) * 2021-11-12 2022-03-18 苏州浪潮智能科技有限公司 Data packet processing optimization method, device, equipment and medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116418752A (en) * 2021-12-30 2023-07-11 苏州盛科通信股份有限公司 Message processing method and device, storage medium and electronic device
CN117828487A (en) * 2024-02-23 2024-04-05 深圳赋乐科技集团有限公司 Method, system, equipment and medium for judging matching result of flow classification rule

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1905523A (en) * 2006-08-02 2007-01-31 华为技术有限公司 Method for implementing multi-area stream classifying
CN101800707A (en) * 2010-04-22 2010-08-11 华为技术有限公司 Method for establishing stream forwarding list item and data communication equipment
US20150341473A1 (en) * 2014-05-23 2015-11-26 Cristian Florin F. Dumitrescu Packet flow classification
CN106326234A (en) * 2015-06-18 2017-01-11 深圳市中兴微电子技术有限公司 Flow classification method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1905523A (en) * 2006-08-02 2007-01-31 华为技术有限公司 Method for implementing multi-area stream classifying
CN101800707A (en) * 2010-04-22 2010-08-11 华为技术有限公司 Method for establishing stream forwarding list item and data communication equipment
US20150341473A1 (en) * 2014-05-23 2015-11-26 Cristian Florin F. Dumitrescu Packet flow classification
CN106326234A (en) * 2015-06-18 2017-01-11 深圳市中兴微电子技术有限公司 Flow classification method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114205115A (en) * 2021-11-12 2022-03-18 苏州浪潮智能科技有限公司 Data packet processing optimization method, device, equipment and medium
CN114205115B (en) * 2021-11-12 2023-07-14 苏州浪潮智能科技有限公司 Data packet processing optimization method, device, equipment and medium

Also Published As

Publication number Publication date
CN112866139A (en) 2021-05-28

Similar Documents

Publication Publication Date Title
US11102120B2 (en) Storing keys with variable sizes in a multi-bank database
WO2021104393A1 (en) Method for achieving multi-rule flow classification, device, and storage medium
US7600094B1 (en) Linked list traversal with reduced memory accesses
US8924687B1 (en) Scalable hash tables
US11362948B2 (en) Exact match and ternary content addressable memory (TCAM) hybrid lookup for network device
WO2016029684A1 (en) Packet processing and forwarding device and method, and computer storage medium
US8799507B2 (en) Longest prefix match searches with variable numbers of prefixes
US7281085B1 (en) Method and device for virtualization of multiple data sets on same associative memory
US8638793B1 (en) Enhanced parsing and classification in a packet processor
US20160191530A1 (en) Technologies for access control
US10313240B2 (en) Technologies for efficient network flow classification with vector bloom filters
CN111371779A (en) Firewall based on DPDK virtualization management system and implementation method thereof
WO2020114239A1 (en) Multicast message processing method and apparatus, storage medium and processor
WO2020093737A1 (en) Message processing method and device, storage medium and optical network terminal
WO2021135491A1 (en) Flow table matching method and apparatus
US11882047B2 (en) Traffic classification method and apparatus
JP2013055642A (en) Extendible multicast transfer method and device for data center
CN113132202B (en) Message transmission method and related equipment
US10263901B2 (en) Service packet processing method, apparatus, and system
WO2008101423A1 (en) System and method for bridge connection
WO2016138845A1 (en) Method and device realizing upload of protocol packet to cpu
WO2014201902A1 (en) Tcam-based table query processing method and apparatus
CN113411380A (en) Processing method, logic circuit and equipment based on FPGA (field programmable gate array) programmable session table
US11018978B1 (en) Configurable hash-based lookup in network devices
WO2017219904A1 (en) Data processing method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20893588

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20893588

Country of ref document: EP

Kind code of ref document: A1