A hardware flow table hash conflict solution method and system

By fixing the length of the singly linked list to 8 during the OVS-DPDK smart network interface card offloading and handling hash collisions through message exchange between hardware and software, the problem of resource waste and performance loss caused by hash collisions is solved, and efficient flow table offloading and forwarding are achieved.

CN116319554BActive Publication Date: 2024-11-26CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211662278.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-23
Publication Date
2024-11-26
Estimated Expiration
2042-12-23

AI Technical Summary

Technical Problem

In the OVS-DPDK offloading of smart network interface cards, existing technologies cannot effectively solve the problems of resource waste and performance loss caused by hardware flow table hash collisions.

Method used

By fixing the length of the singly linked list to 8, the system detects the exchange of messages between hardware and software when the bucket is full. The OVS-DPDK software module is used to handle hash collisions, avoid repeated unloading, and the software provides fallback forwarding of the hash collision flow table.

Benefits of technology

It improves the efficiency of hardware flow table unloading, reduces resource waste and packet loss rate, and enhances system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116319554B_ABST
    Figure CN116319554B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of cloud computing. Aiming at the problem that hash conflicts of hardware flow tables will cause flow tables to be repeatedly unloaded, resulting in waste of software and hardware resources, a hardware flow table hash conflict solution method is proposed. Based on the hash bucket method, the length of the single linked list is fixed, and the message communication mechanism of OVS-DPDK software and hardware is used to prevent OVS from repeatedly unloading flow tables with hash conflicts and full buckets. The software performs bottom-up forwarding, thereby ensuring the packet loss rate and increasing the efficiency of the hardware.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing, and in particular to a method for resolving hardware flow table hash conflicts in smart network card OVS-DPDK unloading. Background Art

[0002] In the smart NIC OVS-DPDK offloading solution, OVS will offload the software flow table to the hardware through the RTE_FLOW interface provided by DPDK. The hardware generally uses a hash table (hereinafter referred to as a hash table) to store the flow table offloaded by the software. When the hardware builds the flow table, we often encounter the situation where the hash values ​​calculated by the keywords of two flow tables are the same, that is, hash conflicts. Hash conflicts are inevitable. Hash conflicts in hardware flow tables will cause the flow table to be repeatedly unloaded, resulting in a waste of software and hardware resources. How to resolve hash conflicts is an urgent problem to be solved.

[0003] There are generally four solutions in the prior art: separation linked list method, open addressing method, rehash method, and establishment of a public overflow area.

[0004] 1) The principle of using the separated linked list method (also called the hash bucket method) to resolve hash conflicts: Use linked lists to resolve conflicts. Elements with the same hash value are grouped into the same subset. Each subset is called a bucket. The elements in each bucket are linked together through a single linked list. The head node of each linked list is stored in the hash table.

[0005] 2) The principle of using open addressing to resolve hash conflicts: When a conflict occurs in the hash address p=f(key) of the keyword key, another hash address p1 is generated based on p. If p1 still conflicts, another hash address p2 is generated based on p, until a non-conflicting hash address pi is found and the corresponding element is stored in it.

[0006] 3) The principle of using rehash to resolve hash conflicts: provide multiple hash functions. If the hash value of the key calculated by the first hash function conflicts, use the second hash function to calculate the hash value of the key. If the second one also conflicts, use the third one, and so on.

[0007] 4) The principle of using a common overflow area to resolve hash conflicts is to divide the hash table into a basic table and an overflow table. The overflow table can be another sequential table or another chip (such as TCAM). All elements that conflict with the basic table are filled into the overflow table.

[0008] However, the above four methods for resolving hash conflicts all have certain defects in the scenario of smart NIC flow table offloading:

[0009] 1) The hash bucket method needs to traverse a single linked list to find the address. When the linked list is long, the performance loss caused by the search is unacceptable.

[0010] 2) The open address method requires a small filling factor α, which occupies a large amount of memory space when the flow table size of smart network cards ranges from several million to tens of millions.

[0011] 3) Rehash requires multiple calculations. When hash conflicts occur frequently, the calculation time is unacceptable.

[0012] 4) Using a common overflow area requires adding additional memory or chips, which will bring considerable power consumption and cost pressure.

[0013] It can be seen that the art is in urgent need of a solution that can overcome the above-mentioned defects and resolve hash conflicts. Summary of the invention

[0014] The purpose of the present invention is to provide a hardware flow table hash conflict solution and system to solve the defects existing in the above-mentioned background technology when solving hash conflicts in the intelligent network card flow table unloading scenario.

[0015] In a first aspect, the present invention provides a method for resolving hardware flow table hash conflicts, characterized in that the method comprises the following steps:

[0016] S100, the hardware receives a first message, parses the first message, extracts a key of the first message and calculates a hash value thereof, and finds a corresponding hash bucket according to the hash value;

[0017] S200, comparing the key of each element of the single linked list in the hash bucket with the key of the message one by one to see if they match;

[0018] S300, if the key does not match, directly skip comparing the next key; if the key matches, perform the corresponding operation according to the corresponding action.

[0019] S400, if the match is not successful until the end of the single linked list, determine whether the number of nodes in the single linked list is a preset value. If so, construct a second message, assign the reason field of the second message to the hash bucket full, and send the second message to the OVS-DPDK software module.

[0020] In a second aspect, a hardware flow table hash conflict resolution system is provided, the system comprising hardware and OVS-DPDK software modules, characterized in that:

[0021] The hardware receives the first message, parses the first message, extracts the key of the first message and calculates its hash value, and finds the corresponding hash bucket according to the hash value;

[0022] Compare the key of each element of the single linked list in the hash bucket with the key of the first message one by one to see if they match; if the key does not match, directly skip comparing the next key; if the key matches, perform the corresponding operation according to the action corresponding to the key.

[0023] If the match is not successful until the end of the single linked list, determine whether the number of nodes in the single linked list is a preset value. If so, construct a second message, assign the reason field of the second message to the hash bucket full, and send the second message to the OVS-DPDK software module.

[0024] Based on the hash bucket method, the present invention fixes the length of the single linked list. When the hardware detects that the corresponding bucket is full in the two situations of flow table miss and flow table unloading, a special reason - hash bucket full - is reported to the software. After receiving this reason, the software will no longer unload the flow. That is, the message communication mechanism of OVS-DPDK software and hardware is used to prevent OVS from repeatedly unloading flow tables with hash conflicts and full buckets. The software forwards the packets at the bottom, which ensures the packet loss rate and increases the efficiency of the hardware. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0026] Figure 1 Hash table structure of hardware flow table;

[0027] Figure 2 Hardware flow table miss message sending flow chart;

[0028] Figure 3 Single flow table unloading flow chart. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0030] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.

[0031] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0032] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0033] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including these elements.

[0034] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0035] The present invention provides a method for solving a hardware flow table hash conflict, and the method comprises the following steps:

[0036] S100, the hardware receives a first message, parses the first message, extracts a key of the first message and calculates a hash value thereof, and finds a corresponding hash bucket according to the hash value;

[0037] S200, comparing the key of each element of the single linked list in the hash bucket with the key of the message one by one to see if they match;

[0038] S300, if the key does not match, directly skip comparing the next key; if the key matches, perform the corresponding operation according to the corresponding action.

[0039] S400, if the match is not successful until the end of the single linked list, determine whether the number of nodes in the single linked list is a preset value. If so, construct a second message, assign the reason field of the second message to the hash bucket full, and send the second message to the OVS-DPDK software module.

[0040] Furthermore, the preset value of the number of nodes in the single linked list can be set to 8. Assuming that the hash algorithm is designed reasonably and hash conflicts are resolved using hash buckets, Poisson distribution indicates that when the number of nodes in the bucket is 8, the probability of a conflict is 6 in 100 million.

[0041] Furthermore, after receiving the second message, OVS-DPDK determines whether the hash bucket of the reason field is full. If so, the mark of the corresponding flow table in the local cache is updated to non-unloadable, and the message corresponding to the flow table is forwarded by the software.

[0042] In one embodiment of the present invention, the first message received by the hardware is the first packet service message of a flow. The second message is a hardware flow table miss message. After receiving the hardware flow table miss message, OVS-DPDK forwards the message and inserts the flow table into the local cache; the judging whether the number of nodes in the single linked list is a preset value also includes, if the judging result is no, directly reporting the hardware flow table miss message to OVS-DPDK;

[0043] Furthermore, after receiving the second message, the OVS-DPDK determines whether the hash bucket of the reason field is full, including, if not, updating the mark of the corresponding flow table in the local cache to be unloadable; the OVS-DPDK unloading module subsequently traverses the local cache flow table, determines whether it can be unloaded through the flow table mark, and if so, constructs an unloading message and sends it to the hardware.

[0044] The present invention is described in detail below with respect to this embodiment, that is, the case where the message received by the hardware is the first service message of a flow.

[0045] See attached Figure 2 , the figure shows the hardware flow table miss message sending flow chart in this embodiment, the specific implementation is as follows:

[0046] 1. After receiving the service message, the hardware extracts the key of the message and calculates the hash value.

[0047] 2. Find the hash bucket and compare the key of each element of the single linked list in the bucket with the key of the message one by one.

[0048] 3. If the key does not match, skip the next comparison directly; if the key matches, forward the message according to the corresponding action.

[0049] 4. If no match is found after traversing to the end of the single linked list, determine whether the number of nodes in the single linked list is equal to 8. If it is equal to 8, modify the reason field value of the miss message to change it to when the hash bucket is full, and then send the message to OVS-DPDK; otherwise, send the miss message directly.

[0050] 5. OVS-DPDK receives the hardware flow table miss message, forwards the message, and inserts the flow table into the local cache.

[0051] 6. If the reason in the miss message header is that the hash bucket is full, mark the flow table in the local cache as non-unloadable; otherwise, mark it as unloadable.

[0052] 7. The OVS-DPDK unloading module subsequently traverses the local cache flow table and determines whether it can be unloaded based on the flow table mark. If it can be unloaded, it constructs an unloading message (including key+action) and sends it to the hardware; if it cannot be unloaded, the flow table will not be unloaded.

[0053] In another embodiment of the present invention, the first message received by the hardware is a flow table unloading message sent by OVS-DPDK. Further, the determining whether the number of nodes in the single linked list is a preset value further includes, if the determination result is no, inserting a new node at the end of the single linked list.

[0054] The present invention is described in detail below with respect to this embodiment, that is, the case where the message received by the hardware is a flow table unloading message sent by OVS-DPDK.

[0055] See attached Figure 3 , the figure shows a single flow table unloading flow chart in this embodiment, and the specific implementation is as follows:

[0056] 1. The hardware receives the flow table unloading message sent by OVS-DPDK, calculates the hash value according to the key, and finds the hash bucket.

[0057] 2. Compare the key of each element of the single linked list in the bucket with the key of the uninstalled software flow table one by one.

[0058] 3. If the key does not match, skip comparing the next one directly; if the key matches, update the corresponding action.

[0059] 4. If no match is found at the end of the singly linked list, and the number of nodes in the singly linked list is equal to 8, the insertion is terminated and the reason field of the reply message is assigned the value of bucket full; otherwise, a new node is inserted at the end of the singly linked list.

[0060] 5. OVS receives the reply message and knows that the hash bucket corresponding to the flow table is full. It updates the mark of the flow table in the local cache as non-unloadable. The flow table will no longer be uninstalled repeatedly in the future, and the messages matching the flow table will be forwarded by the software.

[0061] Based on the original hash bucket method, the present invention fixes the length of the single linked list in the bucket to 8, which can ensure that most flow tables can be unloaded to hardware; and in the two cases of hardware flow table miss and flow table unloading, it is detected that the corresponding hash bucket is full, and this special situation is reported to OVS-DPDK through a fixed field in the software and hardware interaction message. After receiving this reason, OVS-DPDK no longer unloads the flow table, and subsequent messages matched by the flow table are forwarded by OVS-DPDK software.

[0062] The present invention also provides a hardware flow table hash conflict resolution system, the system comprising hardware and OVS-DPDK software modules, characterized in that:

[0063] The hardware receives the first message, parses the first message, extracts the key of the first message and calculates its hash value, and finds the corresponding hash bucket according to the hash value;

[0064] Compare the key of each element of the single linked list in the hash bucket with the key of the first message one by one to see if they match; if the key does not match, skip comparing the next key directly; if the key matches, perform the corresponding operation according to the action corresponding to the key.

[0065] If the match is not successful until the end of the single linked list, determine whether the number of nodes in the single linked list is a preset value. If so, construct a second message, assign the reason field of the second message to the hash bucket full, and send the second message to the OVS-DPDK software module.

[0066] Furthermore, the preset value of the number of nodes in the single linked list can be set to 8. Assuming that the hash algorithm is designed reasonably and hash conflicts are resolved using hash buckets, Poisson distribution indicates that when the number of nodes in the bucket is 8, the probability of a conflict is 6 in 100 million.

[0067] Furthermore, after receiving the second message, OVS-DPDK determines whether the hash bucket of the reason field is full. If so, the mark of the corresponding flow table in the local cache is updated to non-unloadable, and the message corresponding to the flow table is forwarded by the software.

[0068] In one embodiment of the present invention, the first message received by the hardware is the first packet service message of a flow. The second message is a hardware flow table miss message. After receiving the hardware flow table miss message, OVS-DPDK forwards the message and inserts the flow table into the local cache; the judging whether the number of nodes in the single linked list is a preset value also includes, if the judging result is no, directly reporting the hardware flow table miss message to OVS-DPDK;

[0069] Furthermore, after receiving the second message, the OVS-DPDK determines whether the hash bucket of the reason field is full, including, if not, updating the mark of the corresponding flow table in the local cache to be unloadable; the OVS-DPDK unloading module subsequently traverses the local cache flow table, determines whether it can be unloaded through the flow table mark, and if so, constructs an unloading message and sends it to the hardware.

[0070] In another embodiment of the present invention, the first message received by the hardware is a flow table unloading message sent by OVS-DPDK. Further, the determining whether the number of nodes in the single linked list is a preset value further includes, if the determination result is no, inserting a new node at the end of the single linked list.

[0071] It can be understood that the system provided in this embodiment can also be used to implement the various steps in the methods provided in other embodiments of the present invention.

[0072] The present invention also provides a computer device. The computer device is in the form of a general-purpose computing device. The components of the computer device may include but are not limited to: one or more processors or processing units, a system memory, and a bus connecting different system components.

[0073] Computer devices typically include a variety of computer system readable media. These media can be any available media that can be accessed by the computer device, including volatile and non-volatile media, removable and non-removable media.

[0074] The system memory may include a computer system readable medium in the form of volatile memory. The memory may include at least one program product having a set (eg, at least one) of program modules configured to perform the functions of various embodiments of the present invention.

[0075] The processing unit executes various functional applications and data processing by running programs stored in the system memory, such as implementing the methods provided in other embodiments of the present invention.

[0076] The present invention also provides a storage medium containing computer executable instructions, on which a computer program is stored. When the program is executed by a processor, the method provided by other embodiments of the present invention is implemented.

[0077] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for solving hardware flow table hash conflicts, characterized in that: The method consists of the following steps: S100, the hardware receives a first message, parses the first message, extracts a key of the first message and calculates a hash value thereof, and finds a corresponding hash bucket according to the hash value; S200, comparing the key of each element of the single linked list in the hash bucket with the key of the message one by one to see if they match; S300, if the key does not match, skip comparing the next key directly; if the key matches, perform the corresponding operation according to the corresponding action; S400, if the match is not successful until the end of the single linked list, determine whether the number of nodes in the single linked list is a preset value. If so, construct a second message, assign the reason field of the second message to the hash bucket full, and send the second message to the OVS-DPDK software module; after receiving the second message, OVS-DPDK determines whether the reason field is a hash bucket full. If so, update the mark of the corresponding flow table in the local cache to non-unloadable, and the message corresponding to the flow table is forwarded by the software.

2. A method for solving hardware flow table hash conflicts as claimed in claim 1, characterized in that: The hardware receives a first message, including: the first message is a first service message of a flow.

3. A method for solving hardware flow table hash conflicts as claimed in claim 2, characterized in that: If yes, construct a second message, including that the second message is a hardware flow table miss message, and after receiving the hardware flow table miss message, OVS-DPDK forwards the message and inserts the flow table into the local cache; The determining whether the number of nodes in the single linked list is a preset value further includes, if the determination result is no, directly reporting a hardware flow table miss message to OVS-DPDK.

4. A method for solving hardware flow table hash conflicts as claimed in claim 2, characterized in that: After receiving the second message, the OVS-DPDK determines whether the hash bucket is full in the reason field, including, if yes, updating the mark of the corresponding flow table in the local cache to be uninstallable; The OVS-DPDK offload module then traverses the local cache flow table and determines whether it can be offloaded based on the flow table mark. If so, it constructs an offload message and sends it to the hardware.

5. A method for solving hardware flow table hash conflicts as claimed in claim 1, characterized in that: The hardware receives a first message, including: the first message is a flow table unloading message sent by OVS-DPDK.

6. A method for solving hardware flow table hash conflicts as claimed in claim 4, characterized in that: The determining whether the number of nodes in the single linked list is a preset value further includes, if the determination result is no, inserting a new node at the end of the single linked list.

7. A hardware flow table hash conflict resolution system, the system comprising hardware and OVS-DPDK software modules, characterized in that: The hardware receives the first message, parses the first message, extracts the key of the first message and calculates its hash value, and finds the corresponding hash bucket according to the hash value; Compare the key of each element of the single linked list in the hash bucket with the key of the first message one by one to see if they match; if the key does not match, skip comparing the next key directly; if the key matches, perform the corresponding operation according to the action corresponding to the key; If the match is not successful until the end of the single linked list, it is determined whether the number of nodes in the single linked list is a preset value. If so, a second message is constructed, and the reason field of the second message is assigned to the hash bucket full, and the second message is sent to the OVS-DPDK software module; after receiving the second message, OVS-DPDK determines whether the reason field is a hash bucket full. If so, the mark of the corresponding flow table in the local cache is updated to non-unloadable, and the message corresponding to the flow table is forwarded by the software.

8. A computing device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable program, and the executable program enables the processor to perform operations corresponding to the hardware flow table hash conflict resolution method as described in any one of claims 1-6.

9. A computer storage medium, wherein at least one executable program is stored in the storage medium, and the executable program enables a processor to perform operations corresponding to the hardware flow table hash conflict resolution method as described in any one of claims 1-6.