Data flow table consistency verification methods, devices and electronic equipment
By generating audit entry sets on both the virtual switch and the hardware side and performing consistency checks, the problem of inconsistency between flow tables between the virtual switch and the hardware is resolved, improving hardware forwarding performance and avoiding resource waste.
Patent Information
- Application Number
- CN202311277918.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-09-28
AI Technical Summary
In cloud computing, inconsistencies in flow tables between virtual switches and hardware lead to a decline in hardware forwarding performance, and existing technologies struggle to effectively guarantee flow table consistency.
By generating audit entry sets on both the virtual switch side and the hardware side and performing consistency checks, and by using the Handle ID mechanism to establish flow table mapping relationships, the format differences between software and hardware are masked, thereby improving the efficiency of consistency checks.
This ensures consistency of flow tables between the virtual switch and the hardware, improves the forwarding performance of the smart network interface card, and avoids waste of hardware resources.
Smart Images

Figure CN117319247B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, specifically to a data flow table consistency verification method, apparatus, and electronic device. Background Technology
[0002] In the cloud computing field, virtual switches are a crucial component of the network infrastructure within current cloud data centers. The data paths of virtual switches typically consume significant CPU resources during packet forwarding. As data volumes increase, tenants demand higher data forwarding performance, and the performance bottlenecks of software-based data paths become increasingly apparent. To reduce resource consumption and overcome performance bottlenecks, hardware offloading technology has emerged, offloading the data paths of virtual switches to hardware.
[0003] Hardware offloading technology uses smart network interface cards (NICs) as carriers, with software and hardware working together. Through the "first packet upload" mechanism, the virtual switch offloads the forwarding logic executed by the data path, that is, the data flow table, to the smart NIC hardware and is responsible for managing the life cycle of the flow table. The hardware then uses the offloaded flow table to achieve high-speed forwarding of data packets without consuming CPU computing resources.
[0004] However, factors such as abnormal communication causing flow table unloading failure and abnormal aging mechanism leading to flow table loss can disrupt the consistency of flow tables between the virtual switch and the hardware. If the flow tables of the virtual switch and the hardware are inconsistent, the virtual switch will not be able to correctly grasp the flow table information in the hardware, and thus will not be able to properly control the hardware to clean up the flow tables, or may result in flow table residue in the hardware, thereby affecting the forwarding performance of the smart network interface card hardware. Summary of the Invention
[0005] In view of this, this application provides a data flow table consistency verification method, apparatus and electronic device, the main purpose of which is to improve the problem of the impact on the hardware forwarding data packet performance when the flow tables between the virtual switch and the hardware are inconsistent.
[0006] Firstly, this application provides a data flow table consistency verification method, applied to the virtual switch side, the method comprising:
[0007] The data flow table is offloaded to the hardware side; based on the offloading result fed back by the hardware side, the data flow table is marked to obtain the identifier of the data flow table; according to the audit entry template, the first audit entry of the data flow table is generated; based on the identifier of each data flow table and the first audit entry, a first audit entry set is generated; the first audit entry set is checked for consistency with the second audit entry set of the hardware side.
[0008] Secondly, this application provides a data flow table consistency verification method, applied to hardware-side execution, the method comprising:
[0009] After receiving the data flow table that was successfully unloaded from the virtual switch side, an identifier is assigned to the data flow table that was successfully unloaded, and the unloading result is fed back to the virtual switch side; the unloading result includes the identifier.
[0010] According to the audit entry template, generate the second audit entry for the data flow table; based on the identifier of each data flow table and the second audit entry, generate the second audit entry set; and perform a consistency check between the second audit entry set and the first audit entry set on the virtual switch side.
[0011] Thirdly, this application provides a data flow table consistency verification device applied to the virtual switch side, the device comprising:
[0012] The offloading unit is configured to offload the data flow table to the hardware side;
[0013] The marking unit is configured to mark the data flow table based on the unloading result fed back from the hardware side, so as to obtain the identifier of the data flow table;
[0014] The first generation unit is configured to generate the first audit entry of the data flow table according to the audit entry template;
[0015] The second generation unit is configured to generate a first audit entry set based on the identifier of each data flow table and the first audit entry;
[0016] The verification unit is configured to perform a consistency check between the first audit entry set and the second audit entry set on the hardware side.
[0017] Fourthly, this application provides a data flow table consistency verification device, applied to hardware-side execution, the device comprising:
[0018] The receiving unit is configured to, upon receiving a data flow table that has been successfully unloaded from the virtual switch side, assign an identifier to the data flow table that has been successfully unloaded, and feed back the unloading result to the virtual switch side; the unloading result includes the identifier.
[0019] The first generation unit is configured to generate a second audit entry for the data flow table according to the audit entry template;
[0020] The second generation unit is configured to generate a second audit entry set based on the identifier of each data flow table and the second audit entry;
[0021] The verification unit is configured to perform a consistency check between the second audit entry set and the first audit entry set on the virtual switch side.
[0022] Fifthly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the data flow table consistency verification method described in the first or second aspect.
[0023] In a sixth aspect, this application provides an electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the computer program to implement the data flow table consistency verification method described in the first or second aspect.
[0024] By employing the above technical solution, this application provides a data flow table consistency verification method, apparatus, and electronic device. After the data flow table is unloaded to the hardware side, the identifier of the data flow table is obtained based on the unloading result fed back by the hardware side. Then, according to the audit entry template, the first audit entry of the data flow table is generated. Based on the identifier and audit entry of each data flow table, a first audit entry set is generated. And a consistency verification is performed between this first audit entry set and the second audit entry set generated by the hardware side. Compared with related technologies, this application no longer focuses on improving the matching mechanism of flow tables in the hardware. Instead, it establishes two audit entry sets based on their respective data flow tables on the hardware side and the virtual switch side. By polling and comparing the audit entry sets, the consistency of the data flow tables on the virtual switch side and the hardware side is verified, ensuring the consistency of flow tables between the virtual switch and the hardware, thereby ensuring the forwarding performance of the smart network interface card.
[0025] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0026] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0027] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1A flowchart illustrating a data flow table consistency verification method provided in an embodiment of this application is shown.
[0029] Figure 2 This illustration shows an interaction diagram between a virtual switch and the hardware side according to an embodiment of this application;
[0030] Figure 3 A flowchart illustrating another data flow table consistency verification method provided in an embodiment of this application is shown.
[0031] Figure 4 A schematic diagram of the audit entry set provided in an embodiment of this application is shown;
[0032] Figure 5 This illustration shows an interactive flowchart of a data flow table consistency verification method provided in an embodiment of this application.
[0033] Figure 6 This illustration shows a schematic diagram of a data flow table consistency verification device provided in an embodiment of this application;
[0034] Figure 7 A schematic diagram of another data flow table consistency verification device provided in an embodiment of this application is shown. Detailed Implementation
[0035] To better understand the above-mentioned objectives, features, and advantages of this application, the solution of this application will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0036] The data flow table consistency verification method proposed in this embodiment is applied to a data flow table consistency verification device or electronic device. This device or electronic device can be installed or integrated into some virtual machine devices or virtual machine systems, and can execute any of the data flow table consistency verification methods mentioned below during runtime. Similarly, the data flow table consistency verification device applied to the hardware side can also be installed or integrated into some smart network card hardware such as ASIC (Application Specific Integrated Circuit, a proprietary application chip designed and manufactured for specific user requirements and specific electronic systems) or FPGA (Field Programmable Gate Array, an integrated circuit with programmable characteristics pre-designed and implemented on a silicon chip).
[0037] To address the issue of inconsistent flow tables between existing virtual switches and hardware affecting hardware packet forwarding performance, this embodiment provides a flow table consistency verification method, executed on the virtual switch side, such as... Figure 1 As shown, the method includes:
[0038] S101. Unload the data flow table to the hardware side.
[0039] like Figure 2 As shown, hardware offloading technology uses smart network interface cards (NICs) as carriers, with software and hardware working together. Through the "first packet uploading" mechanism, the virtual switch offloads the forwarding logic executed on the data path to the smart NIC hardware and manages the lifecycle of the flow table. The hardware side then uses the offloaded flow table to achieve high-speed forwarding of data packets without consuming CPU computing resources. Figure 2 The FPGA or ASIC in the text represents the hardware side of the smart network card. The virtual switch side of the SOC (System on Chip) will offload the data flow table to the FPGA or ASIC. At the same time, the flow table information also exists in the switch.
[0040] S102. Based on the unloading result fed back from the hardware side, mark the data flow table to obtain the identifier of the data flow table.
[0041] Upon receiving the data flow table, the hardware side provides feedback based on whether the reception was successful or not. The virtual switch side then marks the data flow table according to the offloading result, obtaining an identifier for the data flow table. This identifier is used to establish a mapping between the flow tables in the virtual switch's data path and the offloaded flow tables in the hardware, facilitating subsequent consistency checks using reconciliation algorithms.
[0042] S103. Generate the first audit entry for the data flow table according to the audit entry template.
[0043] The first audit entry pertains to the software side of the virtual switch, while the second audit entry is generated on the hardware side of the smart network interface card. The purpose of constructing audit entries is to convert flow tables in the virtual switch's data path or flow tables offloaded from the hardware into audit entries of a unified paradigm, thereby masking the differences in flow table formats between software and hardware and improving the efficiency of the reconciliation algorithm in reconciling flow tables.
[0044] S104, Generate a set of first audit entries based on the identifier and first audit entry of each data flow table.
[0045] On the virtual switch side, a set of first audit entries is generated based on the identifier of each data flow table and the corresponding first audit entry.
[0046] S105, perform a consistency check between the first audit item set and the second audit item set on the hardware side.
[0047] The first audit entry set is a software audit entry set generated based on the data flow tables and audit entries on the virtual switch side; the second audit entry set is a hardware audit entry set generated based on the data flow tables and audit entries on the hardware side. In this embodiment, the virtual switch side is also called the software side, the smart network card hardware is called the hardware side, the first audit entry set is also called the software audit entry set, and the second audit entry set is also called the hardware audit entry set.
[0048] In this embodiment, after the data flow table is offloaded to the hardware side, the identifier of the data flow table is obtained based on the offloading result fed back by the hardware side. Then, according to the audit entry template, the first audit entry of the data flow table is generated. Based on the identifier and audit entry of each data flow table, a first audit entry set is generated. And a consistency check is performed between the first audit entry set and the second audit entry set generated by the hardware side. Compared with related technologies, this embodiment no longer focuses on improving the matching mechanism of flow tables in the hardware. Instead, it establishes two audit entry sets based on their respective data flow tables on the hardware side and the virtual switch side. By polling and comparing the audit entry sets, the consistency of the data flow tables on the virtual switch side and the hardware side is checked, ensuring the consistency of flow tables between the virtual switch and the hardware, thereby ensuring the forwarding performance of the smart network card.
[0049] Optionally, based on the unloading result fed back from the hardware side, the data flow table is marked to obtain the identifier of the data flow table, including: if the unloading result is successful, recording the identifier contained in the unloading result; if the unloading result is unsuccessful, marking the identifier of the data flow table as 0; if no unloading result is received from the hardware within a preset time period, marking the identifier of the data flow table as 0.
[0050] In this embodiment, based on the unloading result of the data flow table fed back from the hardware side, the data flow table is marked to obtain its identifier. Specifically, if the unloading result is successful, it indicates that the hardware side has received the data flow table, and the identifier contained in the unloading result (assigned by the hardware side) is recorded; if the unloading result fails or no unloading result is received within a certain period of time, the identifier of the data flow table is marked as 0. By establishing the identifier, a one-to-one mapping relationship is established between the flow tables in the virtual switch data path and the unloaded flow tables in the hardware.
[0051] Optionally, generating the first audit entry for the data flow table according to the audit entry template includes: traversing each key-value pair of the data flow table, determining a first matching value in the audit entry template, and generating the first audit entry for the data flow table based on the first matching value.
[0052] In this embodiment, the structure of the data flow table determines the first matching value according to the audit entry template, and then generates the first audit entry of the data flow table based on the first matching value. There is a one-to-one correspondence between the first audit entry and the data flow table. Here, the first matching value only represents the virtual switch side (also known as the software side), while the subsequent second matching value represents the hardware side. The audit entry template unifies the format differences of the data flow table, reducing the complexity of audit reconciliation and improving the efficiency of consistency verification.
[0053] Optionally, based on the identifier of each data flow table and the first audit entry, a first audit entry set is generated, including: using the identifier corresponding to the data flow table as the key value and the first audit entry as the value value to form a key-value pair; and generating a first audit entry set based on the key-value pair corresponding to each data flow table.
[0054] In this embodiment, as Figure 4 As shown, a first audit entry set is established based on the identifier and first audit entry of each data flow table. Each audit entry set is a key-value structure, where the key is the identifier of the flow table and the value is the audit entry corresponding to that flow table. This first audit entry set represents all data flow tables on the virtual switch side and is then compared with the second audit entry set on the hardware side for consistency verification. This ensures the consistency of flow tables between the virtual switch and the hardware, thereby guaranteeing the forwarding performance of the smart network interface card (NIC).
[0055] Optionally, a consistency check is performed between the first audit entry set and the second audit entry set on the hardware side, including: traversing the key value of each key-value pair in the first audit entry set, cleaning up key-value pairs with a key value of 0 in the first audit entry set and deleting the data flow table corresponding to the key value; if the key value is not 0, searching for a value in the second audit entry set that is the same as the key value of the key-value pair; determining whether the value of the key value is the same in the first audit entry set and the second audit entry set; if they are the same, determining that the current key-value pair has passed the consistency check, cleaning up the current key-value pair in the first audit entry set, until all key-value pairs in the first audit entry set have been traversed.
[0056] In this embodiment, firstly, key-value pairs with a Key value of 0 in the first audit entry set are cleaned up. This is to delete data flow tables that failed to be uninstalled or were not successfully uninstalled to the hardware side from the first audit entry set on the software side (also called the software audit entry set). These key-value pairs are then cleaned up in both the first and second audit entry sets. If the Key value is not 0, the second audit entry set is searched for the corresponding Value value for the same Key value. If they are the same, it indicates that the current flow table content is consistent on both the virtual switch side and the hardware side. This consistency check is passed, and the current key-value pair is then cleaned up in the first audit entry set. The purpose of cleaning up key-value pairs in both the first and second audit entry sets is twofold: firstly, to indicate that the current content has been verified; and secondly, to clean up verified content to facilitate subsequent re-traversal of the second audit entry set by the hardware side.
[0057] Optionally, when the Key value is not 0, after searching for a Value value with the same Key value as the Key value in the second audit entry set, the method further includes: if a Value value with the same Key value as the Key value cannot be found in the second audit entry set, then the data flow table corresponding to the Key value of the Key value is deleted on the virtual switch side, and the Key value pair is cleaned up in the first audit entry set; if a Value value with the same Key value can be found, and the Key value is different from the Value value in the first audit entry set and the second audit entry set, then the data flow table corresponding to the Key value of the Key value is deleted on the virtual switch side, and the Key value pair is cleaned up in the first audit entry set.
[0058] In this embodiment, if a value with the same key value as the key value cannot be found in the second audit entry set, the data flow table corresponding to the key value of the key value pair is deleted on the virtual switch side, and the key value pair is cleaned up in the first audit entry set (and the second audit entry set). This situation means that there is no data flow table corresponding to the software side in the second audit entry set on the hardware side, so the data flow table on the software side needs to be deleted.
[0059] If a key-value pair with the same key value can be found, and the key value has a different value in the first audit entry set and the second audit entry set, then the data flow table corresponding to the key value of the key-value pair is deleted on the virtual switch side, and the key-value pair is cleaned up in both the first and second audit entry sets. This situation occurs when certain processes on the hardware side may modify the attributes of the data flow table, resulting in different generated values. Therefore, it is necessary to delete the data flow table corresponding to the key value on both the software and hardware sides to ensure consistency between the two ends.
[0060] It should be noted that, since the above embodiment is executed only from the perspective of the virtual switch, when deleting key-value pairs, only the key-value pairs in the first audit set are deleted. However, in reality, each time the key value in the first audit set is checked, the key-value pairs corresponding to the key value in both the first and second audit sets are deleted after the check. The purpose is twofold: first, to indicate that the traversal of this item is complete; and second, to facilitate the subsequent traversal of the second audit set by the hardware side.
[0061] Furthermore, this embodiment also provides a data flow table consistency verification method, applied to hardware-side execution, such as... Figure 3 As shown, the method includes:
[0062] S301, after receiving the data flow table that was successfully unloaded from the virtual switch side, assigns an identifier to the data flow table that was successfully unloaded and feeds back the unloading result to the virtual switch side.
[0063] S302, Generate the second audit entry for the data flow table according to the audit entry template.
[0064] S303, based on the identifier and second audit entry of each data flow table, generate a set of second audit entries.
[0065] S304, perform a consistency check between the second audit item set and the first audit item set on the virtual switch side.
[0066] Optionally, according to the audit entry template, a second audit entry for the data flow table is generated, including: traversing each key-value pair of the data flow table, determining a second matching value in the audit entry template, and generating a second audit entry for the data flow table based on the second matching value.
[0067] In this embodiment, consistent with the software side, the hardware side generates a second audit entry based on the data flow table according to the audit entry template. The audit entry template unifies the format differences of the data flow table, reducing the complexity of audit reconciliation and improving the efficiency of consistency verification.
[0068] Optionally, based on the identifier and the second audit entry of each data flow table, a second audit entry set is generated, including: using the identifier corresponding to the data flow table as the key value and the second audit entry as the value value to form a key-value pair; and generating a second audit entry set based on the key-value pair corresponding to each data flow table.
[0069] In this embodiment, a second audit entry set is established based on the identifier and second audit entry of each data flow table. Each audit entry set is a key-value structure, where the key is the identifier of the flow table and the value is the audit entry corresponding to that flow table. This second audit entry set represents all data flow tables on the hardware side and is then compared with the first audit entry set on the virtual switch side for consistency verification. This ensures the consistency of flow tables between the virtual switch and the hardware, thereby guaranteeing the forwarding performance of the smart network interface card (NIC).
[0070] Optionally, a consistency check is performed between the second audit entry set and the first audit entry set on the virtual switch side, including: based on the consistency check result on the virtual switch side, if a value with the same key value can be found in the second audit entry set, and the key value is the same as the value in the first and second audit entry sets, then the key value pair is deleted from the second audit entry set; based on the consistency check result on the virtual switch side, if a value with the same key value can be found in the second audit entry set, and the key value is different from the value in the first and second audit entry sets, then the data flow table corresponding to the key value of the key value pair is deleted on the hardware side, and the key value pair is deleted from the second audit entry set.
[0071] In this embodiment, if a key-value pair with the same key value can be found in the second audit entry set, and the key value is the same as the value in both the first and second audit entry sets, then the key-value pair is deleted from the second audit entry set. This case refers to the data flow tables at both ends being consistent, so it is only necessary to delete the key-value pair in both the second and first audit entry sets.
[0072] If a key-value pair with the same key value is found in the second audit entry set, and the key value differs from the value in the first and second audit entry sets, then the data flow table corresponding to the key value of the key-value pair is deleted on the hardware side, and the key-value pair is also deleted from the second audit entry set. This situation refers to a situation where both ends have the data flow table, but the values of the data flow table are different. This may be because the flow table was modified during the process due to other reasons. Therefore, in this case, it is necessary to delete the data flow table corresponding to the key value of the key-value pair on both the hardware side (and the software side), and delete the key-value pair in both the second and first audit entry sets.
[0073] Optionally, after verifying the consistency between the second audit entry set and the first audit entry set on the virtual switch side, the method further includes: traversing the key value of each key-value pair in the second audit entry set, and deleting the data flow table corresponding to the key value of each key-value pair on the hardware side.
[0074] In this embodiment, by traversing the first audit entry set, it is ensured that the first audit entry set is cleared and that the remaining flow tables on the software side can be found in the corresponding flow tables on the hardware side. However, there may be other redundant flow tables on the hardware side, so it is also necessary to traverse the second audit entry set to delete redundant data flow tables and ensure consistency between the two ends.
[0075] Furthermore, to better illustrate the specific steps of the technical solution proposed in this embodiment, a specific implementation method is provided as an example. (In conjunction with...) Figure 5 This illustration shows an interactive flowchart of a data flow table consistency verification method provided in this embodiment. The method includes:
[0076] S501, the virtual switch side offloads the data flow table to the hardware.
[0077] Hardware offloading technology uses smart network interface cards (NICs) as carriers, with software and hardware working together. Through the "first packet uploading" mechanism, the virtual switch offloads the forwarding logic of the data path to the smart NIC hardware and is responsible for managing the lifecycle of the flow table. The hardware side then uses the offloaded flow table to achieve high-speed forwarding of data packets without consuming CPU computing resources.
[0078] S502, the hardware side assigns an identifier to the data flow table for successful unloading.
[0079] A Handle ID tagging mechanism is introduced here to ensure the consistency of flow tables between the virtual switch and the hardware. A Handle ID is assigned to each flow table successfully offloaded from the hardware. Each Handle ID can only point to one or fewer flow tables offloaded from the hardware at a time; that is, each Handle ID corresponds to at most one flow table, or no flow table (this means that a Handle ID corresponded to a flow table at the time of offload, but the flow table may be lost later due to overwriting or other reasons). The Handle ID is a natural number less than or equal to the maximum number of flow tables that the hardware can support for offloading, and Handle IDs can be reused.
[0080] S503 provides feedback on the unloading result from the hardware side to the virtual switch side.
[0081] The hardware side needs to send the unloading result back to the virtual switch. The unloading result should include whether the flow table unloading was successful. If the unloading result is successful, it should also include the Handle ID assigned to the flow table by the smart network interface card.
[0082] S504: Based on the offloading results, the virtual switch marks the data flow table to obtain the identifier of the data flow table.
[0083] The virtual switch will mark the flow tables maintained in its own data path according to the offloading results. The marking logic is as follows:
[0084] For a flow table that is successfully unloaded, the virtual switch marks the unload status of the flow table as yes and records the HandleID (this HandleID is assigned by the hardware side and is only recorded by the virtual switch).
[0085] For flow tables that fail to be offloaded, the virtual switch marks the offload status of the flow table as partial and records the Handle ID as 0;
[0086] When the virtual switch cannot receive the flow table offloading result from the hardware within the timeout period due to factors such as channel blockage between the virtual switch and the hardware, the virtual switch marks the offloading status of the flow table as partial and records the Handle ID as 0.
[0087] Therefore, the virtual switch has marked the data flow tables with Handle IDs for different offloading scenarios. For flows successfully offloaded to hardware, the Handle ID is not 0; otherwise, it is 0. On the hardware side, there are no flow tables with a Handle ID of 0; all flow tables assigned Handle IDs are those that have been successfully offloaded to hardware.
[0088] S5051, the virtual switch side generates the first audit entry of the data flow table according to the audit entry template.
[0089] S5052, the hardware side generates the second audit entry for the data flow table according to the audit entry template.
[0090] To mask the format differences between flow tables in the virtual switch data path and those offloaded in the hardware, and to reduce the complexity of audit reconciliation and improve its efficiency, an audit entry template is introduced. The audit entry template consists of a fixed set of key-value pairs. The set of keys for all key-value pairs in the audit entry template is kset0, and the set of keys for the offloadable flow tables supported by the virtual switch and hardware is kset1. kset1 should be a subset of kset0. The purpose of setting kset0 and kset1 here is to ensure that the audit entry template guarantees the attributes of the flow tables supported by the virtual switch and hardware; otherwise, the converted audit entry attributes may not be supported.
[0091] Each data flow table includes a match section and an action section. Audit entries are generated from flow tables and audit entry templates in the virtual switch or hardware. The construction algorithm is as follows:
[0092] Iterate through the key-value pairs kv-match in the match section of the flow table, and search for matching key-value pairs kv-audit in the audit entry template according to the key value of kv-match.
[0093] If kv-audit is successfully found, the value in kv-match is filled into kv-audit; if kv-audit cannot be found, the iteration ends and the audit entry generation fails.
[0094] Iterate through the key-value pairs kv-action in the action section of the flow table, and search for matching key-value pairs kv-audit in the audit entry template according to the key value of kv-action.
[0095] If kv-audit is successfully found, the value from kv-action is filled into kv-audit; if kv-audit cannot be found, the iteration ends and the audit entry generation fails.
[0096] As a result, the virtual switch side and the hardware side respectively generated the first audit entry (software audit entry) and the second audit entry (hardware audit entry).
[0097] S5061, the virtual switch side generates a set of first audit entries based on the identifier and first audit entry of each data flow table.
[0098] S5062, on the hardware side, generates a set of second audit entries based on the identifier and second audit entry of each data flow table.
[0099] The identifier and audit entry for each data flow table have been obtained above. Based on all data flow tables in the virtual switch and smart NIC, a set of audit entries is then generated. For example... Figure 4 As shown, 101 and 102 in the software audit entry set or hardware audit entry set represent data flow tables, and audit entry 1 and audit entry 2 represent the corresponding audit entries. Furthermore, both the software and hardware audit entry sets are key-value structures, where the key is the Handle ID of the flow table, and the value is the corresponding audit entry of the flow table.
[0100] S507, both ends perform consistency checks based on the first audit item set and the second audit item set.
[0101] After completing the preliminary preparations, the next step is to perform a consistency check based on the first audit entry set and the second audit entry set (in some descriptions, a software audit entry set and a hardware audit entry set are used to represent the virtual switch side and the hardware side, respectively). Optionally, the consistency check includes: traversing the key value of each key-value pair in the first audit entry set, cleaning up key-value pairs with a key value of 0 in the first audit entry set; if the key value is not 0, searching for a value in the second audit entry set that has the same key value as the key value of the key-value pair; determining whether the value of the key value is the same in the first audit entry set and the second audit entry set; if they are the same, the current key-value pair is determined to have passed the consistency check, and the current key-value pair is cleaned up in the first audit entry set, until all key-value pairs in the first audit entry set have been traversed.
[0102] Optionally, when the Key value is not 0, after searching for a Value value with the same Key value as the Key value in the second audit entry set, the method further includes: if a Value value with the same Key value as the Key value cannot be found in the second audit entry set, then the data flow table corresponding to the Key value of the Key value is deleted on the virtual switch side, and the Key value pair is cleaned up in the first audit entry set; if a Value value with the same Key value can be found, and the Key value is different from the Value value in the first audit entry set and the second audit entry set, then the data flow table corresponding to the Key value of the Key value is deleted on the virtual switch side, and the Key value pair is cleaned up in the first audit entry set.
[0103] In practice, the specific method is as follows:
[0104] a. Iterate through the software audit entry set. When the key (Handle ID) value of the current iteration position is 0, clean up the key-value pair pointed to by the current iteration position in the software audit entry set, that is, clean up the key-value pair with the key value of 0 in the first audit entry set.
[0105] b. When the key value at the current iteration position is non-zero, search for key-value pairs with the same key (Handle ID) value in the hardware audit entry set:
[0106] c1. If a key-value pair with the same key cannot be found: reconciliation fails. Based on the key, clean the corresponding flow table in the virtual switch data path and clean the key-value pair pointed to by the current iteration position in the software audit entry set. This situation occurs when a data flow table exists in the software audit entry set but not in the hardware audit entry set. This indicates a discrepancy in the number of flow tables on both ends, so the redundant data flow table on the virtual switch side is deleted. Deleting the key-value pair in both the software and hardware audit entry sets is necessary because after traversing this item, the current item's status indicates that the traversal is complete, and it also facilitates subsequent traversal on the hardware side.
[0107] c2. If key-value pairs with the same key value can be found: then determine whether the values (audit entries) of two key-value pairs with the same key value in the software audit entry set and the hardware audit entry set are equal:
[0108] d1. If the two values are not equal: reconciliation fails. Based on the key, clean the corresponding flow tables in the virtual switch data path and hardware respectively, and delete the two key-value pairs from both the software audit entry set and the hardware audit entry set. This situation means that some subsequent processes may cause the attributes of the data flow table on the hardware side to be modified, resulting in different generated values. Therefore, it is necessary to delete the data flow table corresponding to this key value on both the software and hardware sides to ensure consistency between the two ends. The purpose of deleting the two key-value pairs from both the software audit entry set and the hardware audit entry set is twofold: first, to prove that the current content has been traversed, and second, to facilitate subsequent traversal on the hardware side.
[0109] d2. If the two values are equal, the reconciliation is successful. Delete the two key-value pairs from the software audit entry set and the hardware audit entry set respectively.
[0110] After the above steps, the first audit entry set (software audit entry set) on the software side has been completely traversed. At this point, the first audit entry set has been cleared, and it is guaranteed that all data flow tables on the virtual switch side have corresponding consistent flow tables on the hardware side. However, the second audit entry set on the smart network interface card (NIC) may not yet be cleared, meaning that there may still be redundant flow tables.
[0111] S508, on the hardware side, cleans up the data flow tables corresponding to the key values of redundant key-value pairs in the second audit entry set.
[0112] Optionally, after verifying the consistency between the second audit entry set and the first audit entry set on the virtual switch side, the method further includes: traversing the key value of each key-value pair in the second audit entry set, and deleting the data flow table corresponding to the key value of each key-value pair on the hardware side.
[0113] The hardware audit entry set is iteratively traversed, and the corresponding flow table in the hardware is cleaned up according to the key at the current iteration position, along with the key-value pair pointed to by the current iteration position. The purpose of deleting flow tables is to clean up redundant flow table remnants on the hardware side. At this point, the second audit entry set is also completely cleared, and the data flow tables on both the virtual switch side and the hardware side remain consistent after the above steps. Compared with related technologies, this embodiment does not focus on improving the matching mechanism of flow tables in the hardware. Instead, it establishes two audit entry sets based on their respective data flow tables on the hardware side and the virtual switch side. By polling and comparing the audit entry sets, the consistency of the data flow tables on the virtual switch side and the hardware side is checked, ensuring the consistency of flow tables between the virtual switch and the hardware, thereby guaranteeing the forwarding performance of the smart network interface card.
[0114] Furthermore, this embodiment designs a Handle ID marking mechanism to establish a mapping relationship between flow tables in the virtual switch data path and flow tables offloaded in the hardware. It also designs an audit entry construction mechanism that can convert flow tables in the virtual switch data path or flow tables offloaded in the hardware into audit entries of a unified paradigm, thereby masking the differences in flow table formats between software and hardware and improving the efficiency of the reconciliation algorithm for flow table reconciliation. Using Handle IDs and audit entries, a reconciliation algorithm is proposed, which can ensure the consistency of flow tables in the virtual switch and hardware, and can automatically clean up residual or erroneous flow tables in the hardware. This solves the problem of inconsistency between flow tables in the virtual switch data path and flow tables offloaded in the hardware caused by factors such as offload path blocking and abnormal aging mechanisms in existing technical solutions. It periodically reconciles and cleans up abnormal flow tables in the hardware, avoiding waste of hardware resources, ensuring the forwarding performance of smart network cards, and has good market application scenarios.
[0115] Furthermore, as Figures 1 to 5 The specific implementation of the method shown in this embodiment provides a data flow table consistency verification device, which is applied to the virtual switch side for execution, such as... Figure 6 As shown, the device includes: an unloading unit 61, a marking unit 62, a first generating unit 63, a second generating unit 64, and an inspection unit 65.
[0116] The unloading unit 61 is configured to unload the data flow table to the hardware side;
[0117] The marking unit 62 is configured to mark the data flow table according to the unloading result fed back from the hardware side, so as to obtain the identifier of the data flow table;
[0118] The first generation unit 63 is configured to generate the first audit entry of the data flow table according to the audit entry template;
[0119] The second generation unit 64 is configured to generate a first audit entry set based on the identifier of each data flow table and the first audit entry;
[0120] The verification unit 65 is configured to perform a consistency check between the first audit entry set and the second audit entry set on the hardware side.
[0121] In a specific application scenario, the marking unit 62 is specifically configured to: record the identifier contained in the uninstallation result if the uninstallation result is successful; mark the identifier of the data flow table as 0 if the uninstallation result fails; and mark the identifier of the data flow table as 0 if no uninstallation result is received from the hardware within a preset time period.
[0122] In a specific application scenario, the first generation unit 63 is further configured to traverse each key-value pair of the data flow table, determine a first matching value in the audit entry template, and generate a first audit entry of the data flow table based on the first matching value.
[0123] In a specific application scenario, the second generation unit 64 is further configured to use the identifier corresponding to the data flow table as the key value and the first audit entry as the value value to form a key-value pair; and to generate the first audit entry set based on the key-value pair corresponding to each data flow table.
[0124] In a specific application scenario, the verification unit 65 is further configured to iterate through the key value of each key-value pair in the first audit entry set, clean up key-value pairs with a key value of 0 in the first audit entry set and delete the data flow table corresponding to the key value; if the key value is not 0, search for a value in the second audit entry set that is the same as the key value of the key-value pair; determine whether the value of the key value is the same in the first audit entry set and the second audit entry set; if they are the same, determine that the current key-value pair passes the consistency check, clean up the current key-value pair in the first audit entry set, until all key-value pairs in the first audit entry set have been traversed.
[0125] In specific application scenarios, the verification unit 65 is further configured to: if a value with the same key value as the key value of the key-value pair cannot be found in the second audit entry set, then delete the data flow table corresponding to the key value of the key-value pair on the virtual switch side and clean up the key-value pair in the first audit entry set; if a value with the same key value as the key value of the key-value pair can be found, and the value values of the key value are different in the first audit entry set and the second audit entry set, then delete the data flow table corresponding to the key value of the key-value pair on the virtual switch side and clean up the key-value pair in the first audit entry set.
[0126] This embodiment provides another data flow table consistency verification device, applied to the execution of the second process, such as... Figure 7 As shown, the device includes: a receiving unit 71, a first generating unit 72, a second generating unit 73, and a verification unit 74.
[0127] The receiving unit 71 is configured to, after receiving the data flow table that has been successfully unloaded from the virtual switch side, assign an identifier to the data flow table that has been successfully unloaded, and feed back the unloading result to the virtual switch side; the unloading result includes the identifier.
[0128] The first generation unit 72 is configured to generate a second audit entry for the data flow table according to the audit entry template;
[0129] The second generation unit 73 is configured to generate a second audit entry set based on the identifier of each data flow table and the second audit entry;
[0130] The verification unit 74 is configured to perform a consistency check between the second audit entry set and the first audit entry set on the virtual switch side.
[0131] In a specific application scenario, the first generation unit 72 is further configured to traverse each key-value pair of the data flow table, determine a second matching value in the audit entry template, and generate a second audit entry of the data flow table based on the second matching value.
[0132] In a specific application scenario, the second generation unit 73 is further configured to use the identifier corresponding to the data flow table as the key value and the second audit entry as the value value to form a key-value pair; and to generate the second audit entry set based on the key-value pair corresponding to each data flow table.
[0133] In specific application scenarios, the verification unit 74 is further configured to, based on the consistency verification results on the virtual switch side, if a value with the same key value can be found in the second audit entry set, and the key value has the same value in both the first and second audit entry sets, then delete the key-value pair in the second audit entry set; and based on the consistency verification results on the virtual switch side, if a value with the same key value can be found in the second audit entry set, and the key value has different value in both the first and second audit entry sets, then delete the data flow table corresponding to the key value of the key-value pair on the hardware side, and delete the key-value pair in the second audit entry set.
[0134] In specific application scenarios, the verification unit 74 is further configured to iterate through the key value of each key-value pair in the second audit entry set and delete the data flow table corresponding to the key value of each key-value pair on the hardware side.
[0135] It should be noted that other corresponding descriptions of the functional units involved in the data flow table consistency verification device provided in this embodiment can be found in [reference needed]. Figures 1 to 5 The corresponding description in [the document] will not be repeated here.
[0136] Based on the above, Figures 1 to 5 Accordingly, this embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method. Figures 1 to 5 The method shown.
[0137] Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as CD-ROM, USB flash drive, mobile hard drive, etc.) and includes several instructions to cause a computer device (such as personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of this application.
[0138] Based on the above, Figures 1 to 5 The method shown, and Figure 6 and Figure 7 To achieve the above objectives, this application also provides an electronic device, which can be configured on a computer side, etc. The device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-described objectives. Figures 1 to 5 The method shown.
[0139] Based on the above, Figures 1 to 5The method shown, and Figure 6 and Figure 7 To achieve the above objectives, the present application also provides a chip in the illustrated virtual device embodiment, including one or more interface circuits and one or more processors; the interface circuits are used to receive signals from the memory of an electronic device and send the signals to the processors, the signals including computer instructions stored in the memory; when the processor executes the computer instructions, it causes the electronic device to perform the above-described... Figures 1 to 5 The method shown.
[0140] Optionally, the aforementioned physical devices may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Wi-Fi interfaces), etc.
[0141] Those skilled in the art will understand that the physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0142] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the aforementioned physical device, supporting the operation of information processing programs and other software and / or programs. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software in the information processing physical device.
[0143] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms, or it can be implemented by hardware. By applying the solution of this embodiment, compared with related technologies, this application no longer focuses on improving the matching mechanism of flow tables in hardware, but establishes two audit entry sets based on their respective data flow tables on the virtual switch side and the hardware side, respectively. By polling and comparing the audit entry sets, the consistency of the data flow tables on the virtual switch side and the hardware side is checked, ensuring the consistency of flow tables between the virtual switch and the hardware, thereby ensuring the forwarding performance of the smart network card.
[0144] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the term "comprising" or any other variations thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0145] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A data flow table consistency verification method, characterized in that, The method, applied to the virtual switch side, includes: Offload the data flow table to the hardware side; Based on the unloading result fed back from the hardware side, the data flow table is marked to obtain the identifier of the data flow table; Generate the first audit entry for the data flow table according to the audit entry template; Based on the identifier of each data flow table and the first audit entry, a first audit entry set is generated; Perform a consistency check between the first set of audit entries and the second set of audit entries on the hardware side.
2. The method of claim 1, wherein, The step of marking the data flow table based on the unloading result fed back from the hardware side to obtain the identifier of the data flow table includes: If the uninstallation result is successful, record the identifier contained in the uninstallation result; If the uninstallation fails, the identifier of the data flow table is marked as 0; If no unloading result is received from the hardware within a preset time period, the identifier of the data flow table is marked as 0.
3. The method of claim 1, wherein, The step of generating the first audit entry for the data flow table according to the audit entry template includes: For each key-value pair in the data flow table, traverse it to determine the first matching value in the audit entry template; Based on the first matching value, the first audit entry of the data flow table is generated.
4. The method of claim 2, wherein, The generation of a first audit entry set based on the identifier of each data flow table and the first audit entry includes: The identifier corresponding to the data flow table is used as the key value, and the first audit entry is used as the value value to form a key-value pair; The first audit entry set is generated based on the key-value pairs corresponding to each data flow table.
5. The method of claim 4, wherein, The step of performing a consistency check between the first audit item set and the second audit item set on the hardware side includes: For each key-value pair in the first audit entry set, traverse the key value, clean up the key-value pairs with a key value of 0 in the first audit entry set, and delete the data flow table corresponding to the key value; If the Key value is not 0, search for a key-value pair with the same Key value in the second audit entry set and obtain the Value value of the key-value pair with the same Key value; Determine whether the values of key-value pairs with the same key value in the first audit entry set and the second audit entry set are the same; If they are the same, the current key-value pair is determined to have passed the consistency check, and the current key-value pair is cleaned up in the first audit entry set until every key-value pair in the first audit entry set has been traversed.
6. The method of claim 5, wherein, If the Key value is not 0, after searching for a key-value pair with the same Key value in the second audit entry set and obtaining the Value value of the key-value pair with the same Key value, the process further includes: If a key-value pair with the same key value cannot be found in the second audit entry set and the value of the key-value pair with the same key value cannot be obtained, then the data flow table corresponding to the key value of the key-value pair is deleted on the virtual switch side, and the key-value pair is cleaned up in the first audit entry set. If a key-value pair with the same key value is found and the value of the key-value pair with the same key value is obtained, and the value of the key value is different in the first audit entry set and the second audit entry set, then the data flow table corresponding to the key value of the key-value pair is deleted on the virtual switch side, and the key-value pair is cleaned up in the first audit entry set.
7. A data flow table consistency verification method, characterized in that, The method, applied to hardware-side execution, includes: After receiving the data flow table that was successfully unloaded from the virtual switch side, an identifier is assigned to the data flow table that was successfully unloaded, and the unloading result is fed back to the virtual switch side; the unloading result includes the identifier. Generate the second audit entry for the data flow table according to the audit entry template; Based on the identifier of each data flow table and the second audit entry, a second audit entry set is generated; Perform a consistency check between the second audit entry set and the first audit entry set on the virtual switch side.
8. The method according to claim 7, characterized in that, The step of generating the second audit entry for the data flow table according to the audit entry template includes: For each key-value pair in the data flow table, traverse it to determine a second matching value in the audit entry template; Based on the second matching value, a second audit entry is generated for the data flow table.
9. The method according to claim 7, characterized in that, The generation of a second audit entry set based on the identifier of each data flow table and the second audit entry includes: The identifier corresponding to the data flow table is used as the key value, and the second audit entry is used as the value value to form a key-value pair; The second audit entry set is generated based on the key-value pairs corresponding to each data flow table.
10. The method according to claim 9, characterized in that, The step of performing a consistency check between the second audit entry set and the first audit entry set on the virtual switch side includes: Based on the consistency check results on the virtual switch side, if a key-value pair with the same key value can be found in the second audit entry set and the value of the key-value pair with the same key value is obtained, and the value of the key value is the same in both the first audit entry set and the second audit entry set, then the key-value pair is deleted from the second audit entry set. Based on the consistency check results on the virtual switch side, if a key-value pair with the same key value can be found in the second audit entry set and the value of the key-value pair with the same key value is obtained, and the value of the key value is different in the first audit entry set and the second audit entry set, then the data flow table corresponding to the key value of the key-value pair is deleted on the hardware side, and the key-value pair is deleted in the second audit entry set.
11. The method according to any one of claims 7 to 10, characterized in that, After performing a consistency check between the second audit entry set and the first audit entry set on the virtual switch side, the method further includes: For each key-value pair in the second audit entry set, the key value is traversed, and the data flow table corresponding to the key value of each key-value pair is deleted on the hardware side.
12. A data flow table consistency verification device, characterized in that, The device is used for execution on the virtual switch side and includes: The offloading unit is configured to offload the data flow table to the hardware side; The marking unit is configured to mark the data flow table based on the unloading result fed back from the hardware side, so as to obtain the identifier of the data flow table; The first generation unit is configured to generate the first audit entry of the data flow table according to the audit entry template; The second generation unit is configured to generate a first audit entry set based on the identifier of each data flow table and the first audit entry; The verification unit is configured to perform a consistency check between the first audit entry set and the second audit entry set on the hardware side.
13. A data flow table consistency verification device, characterized in that, The device is used for hardware-side execution and includes: The receiving unit is configured to, upon receiving a data flow table that has been successfully unloaded from the virtual switch side, assign an identifier to the data flow table that has been successfully unloaded, and feed back the unloading result to the virtual switch side; the unloading result includes the identifier. The first generation unit is configured to generate a second audit entry for the data flow table according to the audit entry template; The second generation unit is configured to generate a second audit entry set based on the identifier of each data flow table and the second audit entry; The verification unit is configured to perform a consistency check between the second audit entry set and the first audit entry set on the virtual switch side.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 11.
15. An electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 11.
Citation Information
Patent Citations
Method, device and system for realizing table item check and computer storage medium
CN113190368A
Dataflow consistency verification
US20180367448A1
