Message processing method and device

By using a data processing unit to parse and update table entries, the problem of processing overhead in virtual switches when rules change is solved, achieving efficient table entry management, reducing the load on virtual forwarding devices, and improving the processing performance of network equipment.

CN122073572APending Publication Date: 2026-05-22HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2024-11-22
Publication Date
2026-05-22

AI Technical Summary

Technical Problem

When virtual switches handle rule changes, they need to look up and delete multiple entries, resulting in high processing overhead and impacting network device performance.

Method used

After receiving the message, the data processing unit parses the data stream identifier and obtains the version information, and determines the version consistency. If the version is inconsistent, the message is sent to the virtual forwarding device for processing, and the table entries are updated through the version information table to reduce the processing load of the virtual forwarding device.

Benefits of technology

Entry deletion can be completed quickly, saving processing overhead on virtual forwarding devices and improving the processing performance of network equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122073572A_ABST
    Figure CN122073572A_ABST
Patent Text Reader

Abstract

The invention provides a message processing method and device, and a data processing unit not only needs to search for a first flow table, but also needs to search for a first version information table. Therefore, the data processing unit only triggers the processing of the first message based on the first table item in the first flow table under the condition that the first flow table and the first version information table are hit at the same time. When the first table item in the first flow table fails or needs to be updated, only the virtual forwarding device needs to issue updated version information (such as second version information) to the data processing unit. As the first version information in the first table item is different from the second version information, the data processing unit no longer processes the message (such as the first message) corresponding to the first data flow based on the first table item in the first flow table. In this way, the effect of deleting the first table item in the first flow table is achieved in a short time, a large number of deletion interfaces do not need to be called to delete the first table item, and therefore the processing overhead of the virtual forwarding device side is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and more particularly to a message processing method and apparatus. Background Technology

[0002] A network interface card (NIC) is a network interface controller with forwarding capabilities, enabling it to process network packets. This includes packet forwarding, packet modification, packet checksum calculation, and packet aggregation. NICs are often used in conjunction with virtual machine switches to reduce the processing load on network devices running the virtual switch, thereby improving the virtual switch's processing capabilities.

[0003] In traditional technology, virtual switches store flow tables containing multiple entries, each corresponding to a data flow. Each entry also includes an action instruction that specifies how to process packets belonging to that data flow. Each entry in the flow table is determined based on multiple processing rules in a rule table. When at least one processing rule in the rule table changes, the entry corresponding to that changed rule is no longer suitable for processing packets. In this case, the virtual switch needs to find the entry in the software flow table corresponding to the changed processing rule and delete that entry.

[0004] However, finding the entries to be deleted and deleting them requires significant processing overhead, which may affect the processing performance of network devices. Summary of the Invention

[0005] This application provides a message processing method and apparatus for saving processing overhead on the virtual switch side.

[0006] Firstly, this application provides a message processing method, which can be executed by a data processing unit or by a component of the data processing unit. The data processing unit can be a network interface card (NIC), such as a smart NIC or a data processing unit (DPU) card. Taking the data processing unit as an example, the data processing unit receives a first message and parses a first data stream identifier based on the first message. The first data stream identifier is used to identify the data stream to which the received first message belongs. Then, the data processing unit obtains first version information corresponding to the first data stream identifier in the flow table and second version information corresponding to the first data stream identifier in the version information table. The first version information is located in a first entry in the flow table corresponding to the first data stream identifier. Then, the data processing unit determines that the first version information and the second version information are different and sends the first message to a virtual forwarding device. Then, based on the first data stream identifier and the second version information sent by the virtual forwarding device, the data processing unit updates the first entry to obtain a second entry, which includes the first data stream identifier and the second version information.

[0007] In this aspect, after receiving the first message, the data processing unit not only searches the first flow table in the data processing unit based on the parsed information of the first message, but also, if the first flow table is matched, determines whether the first version information in the first entry matches the version information corresponding to the first entry in the data processing unit. If the first version information and the second version information do not match, the data processing unit does not process the first message based on the first entry in the first flow table, but instead sends the first message to the virtual forwarding device for processing. This not only achieves the effect of deleting the first entry in the first flow table in a short time, but also avoids calling a large number of deletion interfaces to delete the first entry according to traditional technology, thus saving the processing overhead introduced by the virtual forwarding device for deletion processing. In addition, after the data processing unit sends the first message to the virtual forwarding device, the virtual forwarding device can trigger the generation of a second entry for the first data flow to which the first message belongs based on the first message. This second entry includes the first data flow identifier and the second version information. The virtual forwarding device sends the first data stream identifier and the second version information to the data processing unit, enabling the data processing unit to update the first entry in the first flow table to the second entry. Subsequently, the data processing unit can process subsequent packets belonging to the first data stream based on the second entry. This embodiment can transfer the processing load of the virtual forwarding device to the data processing unit, thus reducing the processing load on the virtual forwarding device side and improving the processing performance of the network device.

[0008] In one possible implementation, the data processing unit determines a second entry in the flow table corresponding to the first data flow identifier based on the first data flow identifier obtained from the second message, wherein the second message and the first message belong to the same data flow; then, the data processing unit determines that the second version information included in the second entry is the same as the second version information corresponding to the first data flow identifier in the version information table, and processes the second message based on the second entry.

[0009] In one possible implementation, the first version information differs from the second version information, including: the first version information includes a first version index and a first version value; the second version information includes a first version index and a second version value, and the second version value is different from the first version value.

[0010] In this embodiment, the version information includes a version index and a version value. The first version information and the second version information have the same version index (i.e., the first version index), but different version values ​​(i.e., the first version value and the second version value are different). This embodiment facilitates the data processing unit in finding the version information stored in the data processing unit based on the version index, thereby improving the efficiency of the data processing unit in finding the version information.

[0011] In one possible implementation, the second version information is stored in a version information table in the data processing unit. The version information table includes at least one version information, and each version information corresponds to at least one entry in the first flow table. Different version information corresponds to different entries, and the version information is used to indicate the currently effective version of the corresponding entry.

[0012] In this embodiment, the data processing unit stores a version information table containing multiple version information, which is beneficial for maintaining version information separately according to different table entries, thereby improving the efficiency of enabling or disabling certain table entries through the version information table.

[0013] In one possible implementation, the data processing unit obtains the first version information corresponding to the first data flow identifier in the flow table, including: the data processing unit obtains the first data flow identifier based on the received first message; then, the data processing unit obtains the first version information from the first table entry corresponding to the first data flow identifier in the flow table based on the first data flow identifier and the flow table, wherein the first table entry includes the first data flow identifier and the first version information.

[0014] In one possible implementation, the data processing unit obtains the second version information corresponding to the first data stream identifier in the version information table, including: the data processing unit searches the version information table based on the first version index contained in the first version information in the first table entry, and the version information containing the first version index in the obtained version information table is the second version information.

[0015] In one possible implementation, before the data processing unit obtains the second version information corresponding to the first data stream identifier in the version information table, the method further includes: the data processing unit receiving the second version information from the virtual forwarding device; then, the data processing unit updating the version value corresponding to the first version index in the version information table based on the second version value contained in the second version information, to obtain an updated version information table containing the second version information.

[0016] In this embodiment, the data processing unit receives the second version information but does not receive information for updating the first entry. Since the first entry contains the first version information, which is inconsistent with the second version information in the updated version information table of the data processing unit, the data processing unit does not process the first message upon receiving it. Instead, it sends the first message to the virtual forwarding device for processing. In this embodiment, by only sending the updated version information (e.g., the second version information) to the data processing unit through the virtual forwarding device, the effect of deleting the first entry in the first flow table can be achieved in a short time. It also avoids the need to call numerous deletion interfaces as in traditional techniques to delete the first entry, thus saving processing overhead on the virtual forwarding device side.

[0017] In one possible implementation, the data processing unit updates a first entry to obtain a second entry based on a first data stream identifier and second version information sent by the virtual forwarding device. This includes: the data processing unit receiving a second entry from the virtual forwarding device, the second entry including information about the first data stream and second version information, the second version information being the version information referenced when the second entry was generated; then, the data processing unit updates the first stream table based on the second entry to obtain an updated first stream table, the second entry being used to replace the first entry.

[0018] In this embodiment, the data processing unit receives a second entry to replace the first entry. This second entry includes information about the first data stream and second version information. Furthermore, the version information table in the data processing unit (hereinafter referred to as the first version information table) also contains the second version information. Therefore, when the data processing unit receives a packet belonging to the first data stream (e.g., the first packet), it not only searches the first stream table for a match in the second entry based on the parsing information of the first packet, but also searches the first version information table for a match based on the second version information in the second entry. This triggers the data processing unit to process the packet belonging to the first data stream (e.g., the first packet) based on the action instructions in the second entry. By synchronizing the second entry with the data processing unit, the virtual forwarding device can offload the packet processing load (e.g., the processing load for packets belonging to the first data stream) from the virtual forwarding device to the data processing unit, which helps save processing overhead on the virtual forwarding device side.

[0019] In one possible implementation, after the data processing unit updates the first flow table based on the second entry, the method further includes: the data processing unit receiving a second message and obtaining parsing information of the second message, the parsing information of the second message including a first data flow identifier, the first data flow identifier being used to indicate that the second message corresponds to a first data flow; the data processing unit determining a second entry corresponding to the first data flow based on the first data flow identifier and the updated first flow table; and if the second version information in the second entry is consistent with the second version information in the first version information table, the data processing unit processing the second message based on the action instruction in the second entry.

[0020] In this embodiment, after receiving the second entry from the virtual forwarding device, if the data processing unit receives another packet belonging to the first data stream (e.g., the second packet), the data processing unit can search the first flow table based on the first data stream identifier to find the second entry, and can also search the first version information table based on the second version information in the second entry to trigger the data processing unit to process the second packet based on the action instructions in the second entry. This offloads the processing load of packets (e.g., packets belonging to the first data stream) from the virtual forwarding device to the data processing unit, which helps to save processing overhead on the virtual forwarding device side.

[0021] In one possible implementation, the method further includes: a data processing unit determining a third entry in a flow table corresponding to the second data flow identifier based on the second data flow identifier obtained from the third message; the third entry including the second data flow identifier and first version information; the second data flow identifier being used to identify the data flow to which the third message belongs, and the second data flow identifier being different from the first data flow identifier; then, the data processing unit obtaining the second version information corresponding to the second data flow identifier from the version information table; then, the data processing unit determining that the first version information is different from the second version information, and sending the third message to the virtual forwarding device.

[0022] In this embodiment, a version information in the configuration version information table is referenced by entries corresponding to multiple data flow identifiers. Multiple entries corresponding to data flows can be invalidated during a single refresh of the version information table, which helps improve the efficiency of the virtual forwarding device in managing the flow table.

[0023] In one possible implementation, the method further includes: a data processing unit receiving a second data stream identifier and second version information from a virtual forwarding device; then, the data processing unit updating a third entry based on the second data stream identifier and second version information to obtain a fourth entry, the fourth entry including the second data stream identifier and second version information.

[0024] In one possible implementation, the data processing unit obtains the second version information corresponding to the second data stream identifier in the version information table, including: the data processing unit searches the version information table based on the first version index contained in the first version information in the third table entry, and the version information containing the first version index in the obtained version information table is the second version information.

[0025] In one possible implementation, the data processing unit is a network interface card (NIC) or a digital processing unit (DPU), and the virtual forwarding device is a virtual switch or a virtual machine (VM).

[0026] Secondly, this application provides a message processing method that can be executed by a virtual forwarding device. Taking a virtual forwarding device as an example, the virtual forwarding device determines a second entry in a flow table corresponding to the first message based on a first message from a data processing unit. The second entry includes a first data flow identifier and second version information. The first data flow identifier is used to identify the data flow to which the first message belongs. The virtual forwarding device sends the first data flow identifier and the second version information to the data processing unit.

[0027] In one possible implementation, before the virtual forwarding device determines the second entry in the flow table corresponding to the first packet based on the first packet from the data processing unit, the method further includes: the virtual forwarding device determining, based on the first data flow identifier of the first packet, a first entry in the flow table before the update corresponding to the first data flow identifier, the first entry including the first data flow identifier and first version information; then, the virtual forwarding device determining, based on the first version information, second version information corresponding to the first data flow identifier in the version information table; then, the virtual forwarding device determining that the first version information and the second version information are different, the virtual forwarding device generating a second entry, the second entry including the first data flow identifier and the second version information; then, the virtual forwarding device updating the flow table based on the second entry, the second entry replacing the first entry in the flow table.

[0028] Optionally, the method further includes: the virtual forwarding device processing the first message based on the action instruction in the second entry.

[0029] In this embodiment, when there is no suitable entry for processing the first packet, the virtual forwarding device can generate a second entry suitable for processing the first packet based on the updated first rule information. This helps to ensure the processing of the first packet by the virtual forwarding device and reduces the probability of the first packet processing failure.

[0030] In one possible implementation, the first version information is different from the second version information, including: the first version information includes a first version index and a first version value; the second version information includes a first version index and a second version value, and the first version value is different from the second version value.

[0031] In this embodiment, the version information includes a version index and a version value. The first version information and the second version information have the same version index (i.e., the first version index), but different version values ​​(i.e., the first version value and the second version value are different). This embodiment is beneficial for the virtual forwarding device to find the version information stored in the virtual forwarding device based on the version index, thereby improving the efficiency of the virtual forwarding device in finding the version information.

[0032] In one possible implementation, the virtual forwarding device determines the second version information corresponding to the first data stream identifier in the version information table based on the first version information, including: the virtual forwarding device searches the version information table based on the first version index contained in the first version information in the first table entry, and the version information containing the first version index in the obtained version information table is the second version information.

[0033] In one possible implementation, the virtual forwarding device generates a second entry, including: the virtual forwarding device generates a second entry based on first rule information, the first rule information being used to update a first processing rule in the virtual forwarding device, the first processing rule being related to a first entry in the flow table in the virtual forwarding device.

[0034] In this embodiment, when the first processing rule in the virtual forwarding device changes, the first entry in the second flow table of the virtual forwarding device (i.e., the entry related to the first processing rule) becomes invalid, meaning the first entry is no longer suitable for processing the packet corresponding to the first network flow (e.g., the first packet). At this time, the virtual forwarding device updates the first version information corresponding to the first entry in the second version information table to obtain second version information, and sends this second version information to the data processing unit. This causes the data processing unit to stop processing the packet corresponding to the first network flow (e.g., the first packet) because the first version information in the first entry of the first flow table is inconsistent with the newly issued second version information from the virtual forwarding device. This not only achieves the effect of deleting the first entry in the first flow table in a short time, but also avoids the need to call a large number of deletion interfaces to delete the first entry according to traditional techniques, thus saving processing overhead on the virtual forwarding device side.

[0035] In one possible implementation, before the virtual forwarding device determines the first entry in the flow table corresponding to the first data flow identifier based on the first data flow identifier of the first message, the method further includes: the virtual forwarding device obtaining first rule information; then, the virtual forwarding device determining the version information related to the first rule information in the version information table as the first version information based on the first rule information; then, the virtual forwarding device updating the version value of the first version information in the version information table to obtain the second version information.

[0036] In one possible implementation, the method further includes: the virtual forwarding device sending an updated version information table to the data processing unit; or, the virtual forwarding device sending second version information from the updated version information table to the data processing unit.

[0037] In one possible implementation, the first rule information includes a first rule identifier; the virtual forwarding device stores a first correspondence, which is the correspondence between the first rule identifier and the first version index;

[0038] The virtual forwarding device determines the version information related to the first rule information in the version information table as the first version information based on the first rule information, including: the virtual forwarding device determines the version information of the first version index corresponding to the first rule identifier as the first version information based on the first rule identifier and the first correspondence relationship.

[0039] In this embodiment, the virtual forwarding device can find the first version information related to the first rule based on the stored first correspondence and the first rule identifier. This is beneficial for the virtual forwarding device to quickly find the first version information and generate the second version information, thereby improving the processing efficiency of the virtual forwarding device.

[0040] In one possible implementation, before the virtual forwarding device obtains the first rule information, the method further includes: the virtual forwarding device determining, based on the first data stream identifier of the received fourth message, that there is no entry in the flow table before the update corresponding to the first data stream identifier, wherein the fourth message is the first message in the data stream indicated by the first data stream identifier; then, the virtual forwarding device generates first version information in the version information table based on the first processing rule, and generates a first entry, wherein the first entry includes the first data stream identifier and the first version information.

[0041] In one possible implementation, the method further includes: the virtual forwarding device generating a first correspondence based on the first rule identifier of the first processing rule and the first version index of the first version information; and then, the virtual forwarding device storing the first correspondence in an association table.

[0042] In one possible implementation, the version information table in the virtual forwarding device includes at least one version information, with each version information corresponding to at least one entry in the second flow table. Different version information corresponds to different entries, and the version information is used to indicate the currently active version of the corresponding entry.

[0043] In this embodiment, the virtual forwarding device stores a version information table containing multiple version information, which is beneficial for maintaining version information separately according to different table entries, thereby improving the efficiency of enabling or disabling certain table entries through the version information table.

[0044] In one possible implementation, the method further includes: the virtual forwarding device sending a second entry to the data processing unit, the second entry replacing the first entry in the first flow table in the data processing unit.

[0045] In this embodiment, the virtual forwarding device can send a second entry to the data processing unit to replace the first entry. This second entry includes information about the first network flow and second version information. Furthermore, the first version information table in the data processing unit also contains the second version information. This facilitates triggering the data processing unit to process packets belonging to the first network flow (e.g., the first packet) based on the action instructions in the second entry. By synchronizing the second entry with the data processing unit, the virtual forwarding device can offload the packet processing load (e.g., the processing load for packets belonging to the first network flow) from the virtual forwarding device to the data processing unit, thus saving processing overhead on the virtual forwarding device side.

[0046] In this aspect, when the first processing rule in the virtual forwarding device changes, the first entry in the second flow table of the virtual forwarding device (i.e., the entry related to the first processing rule) becomes invalid, meaning the first entry is no longer suitable for processing the packet corresponding to the first network flow (e.g., the first packet). At this time, the virtual forwarding device updates the first version information corresponding to the first entry in the second version information table to obtain second version information, and sends this second version information to the data processing unit. This causes the data processing unit to stop processing the packet corresponding to the first network flow (e.g., the first packet) because the first version information in the first entry of the first flow table is inconsistent with the newly issued second version information from the virtual forwarding device. This not only achieves the effect of deleting the first entry in the first flow table in a short time, but also avoids the need to call a large number of deletion interfaces to delete the first entry according to traditional techniques, thus saving processing overhead on the virtual forwarding device side.

[0047] Thirdly, this application provides a data processing unit, which includes a processing module and a transceiver module. The transceiver module is used to receive a first message, the first message including a first data stream identifier, the first data stream identifier being used to identify the data stream to which the received first message belongs; the processing module is used to obtain first version information corresponding to the first data stream identifier in a flow table and second version information corresponding to the first data stream identifier in a version information table, the first version information being located in a first entry in the flow table corresponding to the first data stream identifier; the processing module is further used to trigger the transceiver module to send the first message to a virtual forwarding device when it is determined that the first version information and the second version information are different; the processing module is further used to update the first entry to obtain a second entry based on the first data stream identifier and the second version information sent by the virtual forwarding device, the second entry including the first data stream identifier and the second version information.

[0048] In one possible implementation, the processing module is further configured to: determine a second entry in the flow table corresponding to the first data flow identifier based on the first data flow identifier obtained from the second message; and determine that the second version information included in the second entry is the same as the second version information corresponding to the first data flow identifier in the version information table, and process the second message based on the second entry.

[0049] In one possible implementation, the first version information includes a first version index and a first version value; the second version information includes a first version index and a second version value, wherein the second version value is different from the first version value.

[0050] In one possible implementation, the processing module is further configured to obtain a first data stream identifier based on the received first message; and, based on the first data stream identifier and the flow table, obtain first version information from a first entry in the flow table corresponding to the first data stream identifier, wherein the first entry includes the first data stream identifier and the first version information.

[0051] In one possible implementation, the processing module is specifically used to look up the version information table based on the first version index contained in the first version information in the first table entry, and the version information contained in the first version index in the obtained version information table is the second version information.

[0052] In one possible implementation, the transceiver module is used to receive second version information from the virtual forwarding device; the processing module is used to update the version value corresponding to the first version index in the version information table based on the second version value contained in the second version information, so as to obtain an updated version information table containing the second version information.

[0053] In one possible implementation, the processing module is further configured to: determine a third entry in the flow table corresponding to the second data flow identifier obtained from the third message; the third entry includes the second data flow identifier and first version information; the second data flow identifier is used to identify the data flow to which the third message belongs; the second data flow identifier is different from the first data flow identifier; obtain the second version information corresponding to the second data flow identifier in the version information table; and determine that the first version information is different from the second version information, and send the third message to the virtual forwarding device.

[0054] In one possible implementation, the transceiver module is further configured to receive a second data stream identifier and a second version information from the virtual forwarding device; the processing module is further configured to update a third entry based on the second data stream identifier and the second version information to obtain a fourth entry, the fourth entry including the second data stream identifier and the second version information.

[0055] In one possible implementation, the processing module is specifically used to look up the version information table based on the first version index contained in the first version information in the third table entry, and the version information contained in the first version index in the obtained version information table is the second version information.

[0056] It should be noted that the specific implementation methods and beneficial effects of this aspect are similar to some of the implementation methods in the preceding aspects. For details, please refer to the specific implementation methods and beneficial effects of each aspect, which will not be repeated here.

[0057] Fourthly, this application provides a virtual forwarding device, which includes a processing module and a transceiver module. The processing module is used to determine a second entry in a flow table corresponding to a first message from a data processing unit. The second entry includes a first data flow identifier and second version information. The first data flow identifier identifies the data flow to which the first message belongs. The transceiver module is used to send the first data flow identifier and the second version information to the data processing unit.

[0058] In one possible implementation, the processing module is further configured to:

[0059] Based on the first data stream identifier of the first message, a first entry corresponding to the first data stream identifier is determined in the flow table before the update. The first entry includes the first data stream identifier and first version information. Based on the first version information, a second version information corresponding to the first data stream identifier is determined in the version information table. If the first version information and the second version information are different, the virtual forwarding device generates a second entry, which includes the first data stream identifier and the second version information. Based on the second entry, the flow table is updated, and the second entry is used to replace the first entry in the flow table.

[0060] In one possible implementation, the first version information includes a first version index and a first version value; the second version information includes a first version index and a second version value, wherein the first version value is different from the second version value.

[0061] In one possible implementation, the processing module is used to look up a version information table based on the first version index contained in the first version information in the first table entry, and the version information contained in the first version index in the obtained version information table is the second version information.

[0062] In one possible implementation, the processing module is used to generate a second entry based on first rule information, the first rule information being used to update a first processing rule in the virtual forwarding device, the first processing rule being related to a first entry in the flow table in the virtual forwarding device.

[0063] In one possible implementation, the transceiver module is used to acquire first rule information; the processing module is used to determine, based on the first rule information, the version information related to the first rule information in the version information table as the first version information; and to update the version value of the first version information in the version information table to obtain the second version information.

[0064] In one possible implementation, the transceiver module is also used to send the updated version information table to the data processing unit; or, to send the second version information in the updated version information table to the data processing unit.

[0065] In one possible implementation, the first rule information includes a first rule identifier; the virtual forwarding device stores a first correspondence, which is the correspondence between the first rule identifier and the first version index. Specifically, the processing module is used to determine, based on the first rule identifier and the first correspondence, the version information of the first version index corresponding to the first rule identifier as the first version information.

[0066] In one possible implementation, the processing module is used to process the first message based on the action instructions in the second entry.

[0067] In one possible implementation, the processing module is configured to determine, based on the first data stream identifier of the received fourth message, that there is no entry in the flow table before the update that corresponds to the first data stream identifier, wherein the fourth message is the first message in the data stream indicated by the first data stream identifier; and to generate first version information in the version information table based on the first processing rule, and to generate a first entry, wherein the first entry includes the first data stream identifier and the first version information.

[0068] In one possible implementation, the processing module is further configured to generate a first correspondence based on the first rule identifier of the first processing rule and the first version index of the first version information; the processing module is further configured to control the storage module to store the first correspondence in the association table.

[0069] It should be noted that the specific implementation methods and beneficial effects of this aspect are similar to some of the implementation methods in the preceding aspects. For details, please refer to the specific implementation methods and beneficial effects of each aspect, which will not be repeated here.

[0070] Fifthly, this application provides a network device including a processing module, a storage module, and a communication interface. The communication interface is connected to a network interface card (NIC), and the storage module stores a program. The processing module calls the aforementioned program to implement the functions involved in the data processing unit (e.g., NIC) and virtual forwarding device (e.g., virtual switch or virtual machine) described in the first or second aspect.

[0071] Sixthly, embodiments of this application provide a bare-metal server, which is a computing server combining the elasticity of a virtual machine and the performance of a physical machine, used to provide superior computing performance and data security for core databases, critical application systems, high-performance computing, big data, and other services. The bare-metal server includes a processing module and a transceiver module. The processing module may be a processor, and the transceiver module may be an input / output device or a network interface. The bare-metal server may also include a storage module, which may be a memory; the storage module stores instructions, and the processing module executes the instructions stored in the storage module to cause the bare-metal server to perform the functions involved in the data processing unit (e.g., network interface card) and virtual forwarding device (e.g., virtual switch or virtual machine) in the first or second aspects described above.

[0072] In a seventh aspect, embodiments of this application provide a physical machine for running the aforementioned data processing unit (e.g., network interface card) and virtual forwarding device (e.g., virtual switch or virtual machine), and for processing packets based on the data processing unit (e.g., network interface card) and virtual forwarding device (e.g., virtual switch or virtual machine) in the first or second aspect. The physical machine includes a processing module and a transceiver module. The processing module may be a processor, and the transceiver module may be an input / output device or a network interface. The physical machine may also include a storage module, which may be a memory; the storage module stores instructions, and the processing module executes the instructions stored in the storage module to cause the physical machine to perform the functions involved in the data processing unit (e.g., network interface card) and virtual forwarding device (e.g., virtual switch or virtual machine) in the first or second aspect.

[0073] Eighthly, embodiments of this application provide a computer program product containing instructions that, when run on a computer, cause the computer to perform the methods described in any of the foregoing embodiments.

[0074] In a ninth aspect, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the methods described in any of the preceding embodiments. Attached Figure Description

[0075] Figure 1 An example diagram illustrating the interaction between a data processing unit and a virtual forwarding device in traditional technology;

[0076] Figure 2 A flowchart of the message processing method provided in this application;

[0077] Figure 3 Another flowchart of the message processing method provided in this application;

[0078] Figure 4A An example diagram illustrating the interaction between the data processing unit and the virtual forwarding device provided in this application;

[0079] Figure 4B Another example diagram illustrating the interaction between the data processing unit and the virtual forwarding device provided in this application;

[0080] Figure 4C Another example diagram illustrating the interaction between the data processing unit and the virtual forwarding device provided in this application;

[0081] Figure 5 Another flowchart of the message processing method provided in this application;

[0082] Figure 6 A schematic diagram of the data processing unit provided in this application;

[0083] Figure 7 A schematic diagram of the virtual forwarding device provided in this application;

[0084] Figure 8 A schematic diagram of the network device provided in this application. Detailed Implementation

[0085] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0086] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such terms are interchangeable where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0087] It should be understood that the term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone, where A and B can be single or multiple. Additionally, the character " / " in this document generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, "at least one of the following" or similar expressions in this document are used to represent any combination of the listed items; for example, at least one of A, B, and / or C can represent the following six situations: A alone, B alone, C alone, A and B simultaneously, B and C simultaneously, A and C simultaneously, and A, B, and C simultaneously, where A, B, and C can be single or multiple.

[0088] Figure 1 An example diagram illustrating an application scenario to which the message processing method provided in this application is applicable. For example... Figure 1 As shown, this scenario mainly involves a virtual forwarding device and a data processing unit. The virtual forwarding device and the data processing unit can be located in the same network device.

[0089] In this context, a virtual forwarding device refers to a virtual device with packet processing capabilities. For example, this virtual forwarding device can be a virtual switch (vSwitch) or a virtual machine. The virtual forwarding device contains one or more modules, which can process packets serially or in parallel. Examples of processing include packet forwarding, packet modification, packet checksum calculation, and packet aggregation. This virtual forwarding device can run on a physical machine or bare-metal server, or it can run in an intermediate software layer between the underlying physical server and the operating system; this application is not limited to this. For example, the virtual forwarding device can be managed or maintained by a hypervisor (also called a virtual machine monitor, VMM), which is the software, firmware, or hardware used to create and execute virtual machines. It is an intermediate software layer running between the underlying physical server and the operating system, allowing multiple operating systems and applications to share hardware.

[0090] The data processing unit refers to a device with message processing capabilities. For example, the data processing unit can be a network interface card (NIC), meaning it is configured as a network interface controller with forwarding capabilities, capable of processing messages. The NIC can be a smart NIC, such as a smart network interface controller (Smart NIC) or a data processing unit (DPU), etc., and this application is not limited to these categories. NICs are often used in conjunction with virtual machine switches to reduce the processing load on network devices running virtual switches, thereby improving the processing capabilities of the virtual switches.

[0091] like Figure 1 As shown, the virtual forwarding device stores a rule table containing multiple processing rules. The virtual forwarding device can generate an entry for a specific flow based on at least one processing rule in the rule table and store this entry in the virtual forwarding device's flow table. For example, the virtual forwarding device can generate an entry for flow 1 based on rules 1 and 2. As another example, the virtual forwarding device can generate an entry for flow 2 based on rules 1 and 3. Each entry in the flow table includes a flow identifier and an action instruction. The flow identifier indicates which flow the entry belongs to, allowing the virtual forwarding device to determine which entry corresponds to the flow of a received packet; the action instruction indicates how to process the packet. Furthermore, the virtual forwarding device can send its flow table to the data processing unit, and the data processing unit can store the flow table from the virtual forwarding device. When the data processing unit receives a packet, it can look up the flow table in its own table based on the flow identifier contained in the packet. If the flow table contains an entry corresponding to the flow identifier, the data processing unit processes the packet based on the action instruction in that entry.

[0092] However, in some scenarios, the rules in the rule table of the virtual forwarding device may change. In this case, the entries in the flow table associated with the changed rule are no longer suitable for processing packets for the corresponding flow. Therefore, the virtual forwarding device will look for the entries associated with the changed rule and delete them to avoid processing received packets based on inappropriate entries. For example, if rule 1 in the rule table of the virtual forwarding device changes, the virtual forwarding device will find the entries for flow 1 and flow 2 associated with rule 1, and delete the entries for flow 1 and flow 2.

[0093] However, when multiple rules in the rule table change, the virtual forwarding device needs to look up multiple entries and perform deletion operations on the found entries. This lookup and deletion process incurs significant processing overhead on the virtual forwarding device side, which may affect the processing performance of network devices.

[0094] To address this issue, this application provides a message processing method and related apparatus, which can save processing overhead caused by deletion processing and improve efficiency.

[0095] The following will combine Figure 2 The main flow of the message processing method provided in this application is described. For example... Figure 2 As shown, the data processing unit and the virtual forwarding device mainly perform the following steps:

[0096] Step 201: The data processing unit receives the first message.

[0097] The first message includes a first data stream identifier. For example, the data processing unit can perform parsing processing on the received first message to obtain parsing information of the first message, which includes the first data stream identifier. Exemplarily, the first data stream identifier includes one or more of the following: source IP address, source port information, destination IP address, destination port information, or transport layer protocol. Optionally, the first data stream identifier may also include tunnel information and Layer 2 information, etc., which are not specifically limited here.

[0098] It should be noted that the first data stream identifier is used to identify the data stream to which the first message belongs; that is, the first data stream identifier can indicate which data stream the first message belongs to. For example, the data processing unit can determine that the message belongs to the first data stream based on one or more of the source IP address, source port information, destination IP address, destination port information, or transport layer protocol contained in the first data stream identifier. For ease of explanation, it will be referred to below as the first data stream identifier of the first message indicating that the first message corresponds to the first data stream, that is, the first message belongs to the first data stream.

[0099] It should also be noted that the first message can come from an external switch or other virtual forwarding devices; this embodiment is not limited to any of these.

[0100] It should also be noted that this first data stream identifier can be used as an index for querying the flow table; this first data stream identifier is also called key information. Please refer to step 202 for details.

[0101] Step 202: The data processing unit obtains the first version information corresponding to the first data stream identifier in the flow table.

[0102] Specifically, the first version information is located in the flow table of the data processing unit, and the first version information is located in the first entry in the flow table corresponding to the first data flow identifier. For example, the data processing unit determines the first entry corresponding to the first data flow identifier based on the first data flow identifier and the flow table, and the first entry includes the first data flow identifier and the first version information.

[0103] Optionally, the flow table in the data processing unit includes multiple entries, with different entries corresponding to different data flows. Each entry contains a data flow identifier corresponding to that entry and an action instruction corresponding to that data flow. The data flow information indicates which data flow the entry corresponds to, and the action instruction indicates how to process packets belonging to that data flow. Furthermore, unlike flow tables in traditional technologies, the flow table in the data processing unit of this embodiment also includes version information in its entries. It should be noted that the flow table in the data processing unit is determined by the data processing unit based on entries issued by the virtual forwarding device, and the entries issued by the virtual forwarding device are generated by the virtual forwarding device. Therefore, the version information contained in the entry can be understood as the version information referenced by the virtual forwarding device when generating the entry. For ease of explanation, the flow table in the data processing unit will be referred to as the first flow table, and the flow table in the virtual forwarding device will be referred to as the second flow table. Since the data processing unit can be implemented as a hardware network interface card (NIC), the flow table in the data processing unit can also be called a hardware flow table. Since virtual forwarding devices are generally implemented in software, the flow tables in virtual forwarding devices can also be called software flow tables. It should be understood that "first flow table" and "second flow table" are merely examples, and the description of "first flow table" in the following text can be replaced with "flow table in data processing unit" or "hardware flow table," and the description of "second flow table" in the following text can be replaced with "flow table in virtual forwarding device" or "software flow table." This application does not limit the specific name of the flow table.

[0104] For example, if the first data stream corresponds to the first entry, the first entry includes a first data stream identifier, a first action instruction for the first data stream, and first version information. The first data stream identifier indicates that the first entry corresponds to the first data stream, the first action instruction indicates how to process packets belonging to the first data stream, and the first version information is the version information of the first entry, i.e., the version information referenced by the virtual forwarding device when generating the first entry.

[0105] It should be noted that, since the first version information is the version information referenced when the virtual forwarding device generates the first entry (i.e., the entry corresponding to the first data stream), meaning the first version information reflects the currently effective version of the first entry, the version information of the entry corresponding to the first data stream also needs to be adjusted when the first entry becomes invalid or the content of the entry corresponding to the first data stream changes. Please refer to the following text for an introduction to updating version information. Figure 3 Steps 303 to 305 in the corresponding embodiments will not be described in detail here.

[0106] Optionally, the first entry includes a first matching field and a first action field, the first data stream identifier is located in the first matching field, the action instruction corresponding to the first data stream is located in the first action field, and the first version information is located in the first action field or the first matching field.

[0107] In this embodiment, if the flow table in the data processing unit includes a first entry corresponding to the first data flow, the data processing unit can query the first entry corresponding to the first data flow based on the parsing information of the first message (e.g., the first data flow identifier), and thus obtain the first version information and the first action instruction. For example, if the first data flow identifier contained in the parsing information of the first message matches the first data flow identifier contained in the first entry, the data processing unit determines that the first message belongs to the first data flow and can obtain the first version information and the first action instruction.

[0108] Step 203: The data processing unit searches the version information table based on the first version information.

[0109] For example, the data processing unit searches the version information table in the data processing unit based on the first version information contained in the first table entry.

[0110] The version information table stored in the data processing unit includes at least one version information. This version information table is determined by the data processing unit based on the version information issued by the virtual forwarding device. The version information issued by the virtual forwarding device is generated by the virtual forwarding device and is referenced by the virtual forwarding device when generating one or more table entries. For ease of explanation, the version information table in the data processing unit will be referred to as the first version information table, and the version information table in the virtual forwarding device will be referred to as the second version information table. It should be understood that "first version information table" and "second version information table" are merely examples. The description of "first version information table" in the following text can be replaced with the version information table in the data processing unit or other names, and the description of "second version information table" in the following text can also be replaced with the version information table in the virtual forwarding device or other names. This application does not limit the specific name of the version information table.

[0111] Optionally, version information includes a version index and a version value. For example, first version information includes a first version index and a first version value.

[0112] The data processing unit searches the first version information table based on the first version information contained in the first table entry. If the first version information table does not contain the first version information, the data processing unit executes step 204a; if the first version information table contains the first version information, the data processing unit executes step 204b. Furthermore, after executing step 204a, the data processing unit and the virtual forwarding device will also execute steps 205 to 207. If the data processing unit executes step 204b, then the data processing unit and the virtual forwarding device will not execute steps 205 to 207.

[0113] Step 204a: The data processing unit sends the first message to the virtual forwarding device.

[0114] In this embodiment, step 204a is an optional step. For example, if the first version information table does not include first version information, that is, if the data processing unit fails to find the first version information table based on the first version information, the data processing unit executes step 204a.

[0115] In one possible implementation, the first version information table does not include first version information. This can be understood as the version value having the same version index as the first version information being different from the first version value. For example, the first version information includes a first version index and a first version value; the first version information table includes second version information, which includes a first version index and a second version value, and the second version value is different from the first version value. That is, the data processing unit searches the first version information table based on the first version index contained in the first version information in the first table entry. The version information in the first version information table that contains the first version index is the second version information, and the version value of the second version information (i.e., the second version value) is different from the version value of the first version information (i.e., the first version value).

[0116] Because the version value corresponding to the first version index stored in the first table entry of the data processing unit (i.e., the first version value) is different from the version value corresponding to the first version index stored in the first version information table (i.e., the second version value), meaning that the version of the first table entry in the data processing unit at the current moment is inconsistent with the version stored in the first version information table, it indicates that the data processing unit only updated the version information table and not the first flow table. Therefore, the first table entry for the first data flow in the current first flow table is no longer suitable for processing the first packet. Consequently, the data processing unit sends the virtual forwarding device to the first packet so that the virtual forwarding device can process the first packet.

[0117] Step 204b: The data processing unit processes the first message based on the first table entry.

[0118] For example, the data processing unit processes the first message based on the action instructions in the first table entry.

[0119] In this embodiment, step 204b is an optional step. For example, if the first version information table includes first version information, that is, if the data processing unit finds a match in the first version information table based on the first version information, the data processing unit executes step 204b.

[0120] In one possible implementation, the first version information table includes first version information, which can be understood as meaning that a version value with the same version index as the first version information is the same as the first version value. For example, the first version information includes a first version index and a first version value; the first version information table also includes first version information, that is, the first version information table includes a first version index and a first version value. In other words, the data processing unit searches the first version information table based on the first version index contained in the first version information in the first table entry, and the version information in the first version information table containing the first version index is the first version information.

[0121] Since the version value (i.e., the first version value) corresponding to the first version index stored in the first entry of the data processing unit is the same as the version value (i.e., the first version value) corresponding to the first version index stored in the first version information table, it means that the version of the first entry in the data processing unit at the current moment is consistent with the version stored in the first version information table. This indicates that the first entry has not expired or changed. Therefore, the first entry in the first flow table regarding the first data flow is suitable for processing the first message. Furthermore, the data processing unit processes the first message based on the first action instruction contained in the first entry of the first flow table to obtain the processing result of the first message.

[0122] In this embodiment, after receiving the first message, the data processing unit not only searches its own flow table (i.e., the first flow table), but also, if the first flow table match is found, searches its own version information table (i.e., the first version information table) based on the first version information in the found first entry. If the first version information in the first entry matches the corresponding version information in the first version information table, the first entry in the current data processing unit is valid, and the data processing unit can then process the first message based on the first action instruction contained in the first entry. If the first version information table does not contain the first version information in the first entry, the first entry in the current data processing unit is invalid, and the data processing unit needs to send the first message to the virtual forwarding device for processing. In this embodiment, by configuring the data processing unit to search the first version information table, the data processing unit only triggers processing of the first message based on the first entry in the first flow table when both the first flow table and the first version information table match. When the first entry in the first flow table becomes invalid or needs to be updated, the virtual forwarding device only needs to send updated version information (e.g., second version information) to the data processing unit. Because the first version information in the first entry is inconsistent with the second version information, the data processing unit no longer processes the packet corresponding to the first data stream (e.g., the first packet) based on the first entry in the first flow table. This not only achieves the effect of deleting the first entry in the first flow table in a short time, but also eliminates the need to call a large number of deletion interfaces to delete the first entry according to traditional techniques, thus saving processing overhead on the virtual forwarding device side.

[0123] In addition, the virtual forwarding device and the data processing unit will perform the following steps after receiving the first message:

[0124] Step 205: The virtual forwarding device determines the second entry in the flow table corresponding to the first packet based on the first packet.

[0125] For example, the virtual forwarding device determines a second entry in its flow table (hereinafter referred to as the second flow table) corresponding to the first packet based on the first packet. This second entry includes a first data flow identifier and second version information. The first data flow identifier identifies the data flow to which the first packet belongs, and the second version information is the version information referenced by the virtual forwarding device when generating the second entry. Furthermore, the second entry also includes a second action instruction. In essence, the second entry is an updated entry suitable for processing packets belonging to the first data flow.

[0126] For a detailed explanation of the specific implementation of the virtual forwarding device generating the second entry based on the first message, please refer to the following text. Figure 5 The relevant descriptions in the corresponding embodiments will not be repeated here.

[0127] Step 206: The virtual forwarding device sends a first data stream identifier and a second version information to the data processing unit; correspondingly, the data processing unit receives the first data stream identifier and the second version information sent by the virtual forwarding device.

[0128] The second version information is used by the data processing unit to update the version information in the first table entry corresponding to the first data stream identifier, resulting in a second table entry. This second table entry includes the first data stream identifier and the second version information. Furthermore, the second table entry also includes a second action instruction.

[0129] Step 207: The data processing unit updates the first entry in the flow table to obtain the second entry.

[0130] For example, the data processing unit replaces the first entry in the first flow table (i.e., the flow table in the data processing unit) with the second entry.

[0131] Since the data processing unit updates the entry in the first flow table corresponding to the first data flow, meaning that the second entry in the first flow table currently stored by the data processing unit is applicable to processing messages belonging to the first data flow, if the data processing unit receives a message belonging to the first data flow again, the data processing unit can search the first flow table for the second entry based on the first data flow identifier, and can also search the first version information table for the second entry based on the second version information in the second entry. Thus, the data processing unit can process the message belonging to the first data flow based on the second action instruction in the second entry.

[0132] For example, the data processing unit receives a second message, parses the second message to obtain a first data stream identifier, and then determines a second entry in the flow table corresponding to the first data stream identifier based on the first data stream identifier. This second entry includes the first data stream identifier, second version information, and a second action instruction. The data processing unit then determines that the second version information included in the second entry is the same as the second version information corresponding to the first data stream identifier in the version information table. The data processing unit then processes the second message based on the second action instruction in the second entry.

[0133] In this embodiment, after the data processing unit sends the first packet to the virtual forwarding device, the virtual forwarding device can trigger the generation of a second entry for the first data stream to which the first packet belongs, based on the first packet. The second entry includes a first data stream identifier and second version information. The virtual forwarding device sends the first data stream identifier and second version information to the data processing unit, enabling the data processing unit to update the first entry in the first flow table to the second entry. Subsequently, the data processing unit can process subsequently received packets belonging to the first data stream based on the second entry. This embodiment can transfer the processing load of the virtual forwarding device to the data processing unit, thus reducing the processing load on the virtual forwarding device side and improving the processing performance of the network device.

[0134] It should also be noted that the same version information in the version information table (e.g., the first version information table and the second version information table) provided in this embodiment can be referenced by entries corresponding to different data flow identifiers. Therefore, when the data processing unit receives a packet belonging to another data flow, after the data processing unit finds a match in the first flow table, it may not find a match in the first version information table. In this case, the data processing unit will also send the packet to the virtual forwarding device to trigger the virtual forwarding device to generate a new entry for the packet.

[0135] For example, taking the data processing unit receiving a third message belonging to the second data stream as an example, the data processing unit obtains a second data stream identifier based on the third message, which is different from the first data stream identifier. Then, the data processing unit determines a third entry in the first stream table corresponding to the second data stream identifier based on this identifier. This third entry includes the second data stream identifier and first version information, where the second data stream identifier identifies the data stream to which the third message belongs. Next, the data processing unit obtains the second version information corresponding to the second data stream identifier from the first version information table. Since the first version information in the third entry is different from the second version information in the first version information table, the data processing unit sends the third message to the virtual forwarding device so that the virtual forwarding device processes the third message. After receiving the third message, the virtual forwarding device can generate a fourth entry corresponding to the second data stream identifier, which includes the second data stream identifier and the second version information. After the virtual forwarding device sends the second data stream identifier and the second version information to the data processing unit, the data processing unit can update the third entry based on the second data stream identifier and the second version information to obtain the fourth entry, which includes both the second data stream identifier and the second version information.

[0136] In this embodiment, a version information in the configuration version information table is referenced by entries corresponding to multiple data flow identifiers. Multiple entries corresponding to data flows can be invalidated during a single refresh of the version information table, which helps improve the efficiency of the virtual forwarding device in managing the flow table.

[0137] For ease of understanding, the following description uses a virtual forwarding device as a virtual switch and a network interface card (NIC) as a data processing unit to further illustrate the packet processing method provided in this application. It should be noted that the NIC can be a smart NIC, such as a smart network interface controller (Smart NIC) or a data processing unit (DPU). If the NIC in this embodiment is a Smart NIC, then the virtual switch in this embodiment can be a program running on the processor of a network device or computer; if the NIC in this embodiment is a DPU card, then the virtual switch in this embodiment can run on the processing unit of the DPU card. Furthermore, the NIC in this application embodiment can also be other network interface controllers with packet processing and intelligent forwarding functions; this embodiment is not limited to any of these.

[0138] like Figure 3 As shown, the network interface card (NIC) and virtual switch mainly perform the following steps:

[0139] Step 301: The virtual switch obtains the first rule information.

[0140] For example, a virtual switch receives first rule information from a controller. This first rule information is new rule information issued by the controller, used to update the first processing rule in the virtual switch. In other words, the first rule information updates the content of the first processing rule in the virtual switch. Based on the received first rule information, the virtual switch locates the previously stored first processing rule and updates its content to obtain the updated first processing rule. For example, if the virtual switch stores a first processing rule that specifies processing A, and the first rule information indicates that the first processing rule specifies processing B, then the virtual switch updates its stored first processing rule to process B.

[0141] Optionally, the virtual switch stores multiple processing rules, including a first processing rule. The virtual switch uses the first rule information to find the first processing rule that needs to be updated from the multiple processing rules. For example, the first rule information includes a first rule identifier. The virtual switch uses the first rule identifier to find the first processing rule that needs to be updated from the multiple processing rules stored in the virtual switch.

[0142] Optionally, the virtual switch stores a rule table, which includes at least one processing rule. The virtual switch updates at least one processing rule in the rule table based on the first rule information to obtain an updated rule table.

[0143] In one possible implementation, the virtual switch stores multiple rule tables, meaning that multiple processing rules in the virtual switch reside in multiple rule tables, and each rule table includes multiple processing rules. For example, ... Figure 4A As shown, the virtual switch stores N rule tables, such as rule table 1 and rule table 2. Rule table 1 contains X processing rules, rule table 2 contains Y processing rules, and so on. Here, N is an integer greater than 1, and X and Y are integers greater than 0. In this embodiment, rule identifiers can be represented by table numbers and rule numbers. For example, (1, 1) represents rule 1 in table 1; (2, 1) represents rule 1 in table 2. For example, if the first rule identifier contained in the first rule information indicates rule 1 in table 1, then the virtual switch updates the content of rule 1 in table 1 based on the first rule information, obtaining the updated rule 1'.

[0144] In another possible implementation, the virtual switch stores only one rule table, meaning multiple processing rules in the virtual switch reside in the same rule table. For example, the virtual switch stores N processing rules, such as rule 1, rule 2, ..., rule N, where N is an integer greater than 1. In this implementation, rule identifiers can be represented by rule numbers. For example, 1 represents rule 1, and 2 represents rule 2.

[0145] It should be noted that the rule table in this embodiment can be an OpenFlow table, or other tables or data structures with similar functions. This embodiment is not limited to any particular type.

[0146] Optionally, the first processing rule is related to the first entry in the second flow table within the virtual switch. The second flow table is the flow table stored by the virtual switch, i.e., the software flow table generated by the virtual switch. For example... Figure 4A As shown, the second flow table includes multiple entries, with different entries corresponding to different data flows. Each entry contains a data flow identifier and an action instruction corresponding to that data flow. The data flow identifier indicates which data flow the entry corresponds to, and the action instruction indicates how to process packets belonging to that data flow. Furthermore, unlike software flow tables in traditional technologies, the second flow table in this embodiment also includes version information in its entries. This version information refers to the version information of the entry itself. Since the second flow table is generated by a virtual switch, meaning the entries in the second flow table are generated by the virtual switch, the version information contained in the entries in the second flow table can be understood as the version information referenced by the virtual switch when generating the entry.

[0147] For example, if a first data stream corresponds to a first table entry, the first table entry includes a first data stream identifier, a first action instruction for the first data stream, and first version information. The first data stream identifier indicates that the first table entry corresponds to a first data stream, the first action instruction indicates how to process packets belonging to the first data stream, and the first version information is the version information referenced by the virtual switch when generating the first table entry. Optionally, the version information includes a version index and a version value. For example, the first version information includes a first version index and a first version value. For example, with... Figure 4A For example, the second flow table includes entry 1 corresponding to data flow 1, entry 2 corresponding to data flow 2, and so on. Taking entry 1 as an example, entry 1 includes the identifier of data flow 1, version information 1 (including version index 1 and version value 1), and action instructions for data flow 1.

[0148] Optionally, the first entry includes a first matching field and a first action field, the first data stream identifier is located in the first matching field, the first action instruction corresponding to the first data stream is located in the first action field, and the first version information is located in the first action field or the first matching field.

[0149] It should be noted that the first version information is the version information referenced by the virtual switch when generating the first entry (i.e., the entry corresponding to the first data flow). In other words, the first version information reflects the version in effect when the first entry was generated. Therefore, when the first entry becomes invalid or the content of the entry corresponding to the first data flow changes, the version information of the entry corresponding to that first data flow also needs to be adjusted. Please refer to the following text for an introduction to updating version information. Figure 3 Steps 303 to 305 in the corresponding embodiments will not be described in detail here.

[0150] Step 302: The virtual switch determines the first version information corresponding to the first rule information in the second version information table based on the first rule information.

[0151] For an explanation of the first rule information, please refer to the introduction in step 301 above, which will not be repeated here.

[0152] The second version information table is a version information table stored by the virtual switch. The second version information table includes at least one version information. When generating an entry in the second flow table, the virtual switch references a version information from the second version information table; alternatively, when generating an entry in the second flow table, the virtual switch can generate a version information and record that version information in both the first entry of the second flow table and the second version information table.

[0153] Optionally, a version information can be referenced by at least one entry in the second flow table; that is, a version information corresponds to at least one entry in the second flow table. For example, such as Figure 4A As shown, version information 1 in the second version information table corresponds to entries in data streams 1 through 'a' in the second flow table. Entries in data streams 1, 2, and 'a' in the second flow table all reference version information 1 in the second version information table. Similarly, version information 2 in the second version information table corresponds to entries in data streams a+1 and a+2 in the second flow table; that is, entries in data streams a+1 and a+2 in the second flow table reference version information 2 in the second version information table. Here, 'a' is an integer greater than 1.

[0154] Optionally, different entries may reference the same version information, but the same entry references only one version information. That is, at any given time, the same version information may correspond to one or more entries, and the same entry corresponds to only one version information; different version information corresponds to different entries. For example, ... Figure 4A As shown, entries in data flow 1 reference version information 1, and entries in data flow 2 also reference version information 1. At any given time, entries in data flow 1 only reference version information 1 and do not reference other version information simultaneously, and entries in data flow 2 only reference version information 1 and do not reference other version information simultaneously.

[0155] For example, taking the generation of a first entry in the second flow table by a virtual switch as an example, the virtual switch generates a first entry in the second flow table. This first entry includes a first data flow identifier and first version information. This first version information is a version information referenced by the virtual switch in the second version information table. It can also be understood that the virtual switch generates the first version information simultaneously with the generation of the first entry, and this first version information is recorded not only in the second version information table but also in the first entry of the second flow table.

[0156] Furthermore, there is a correspondence between the version information in the second version information table and the processing rules in the rule table. The virtual switch determines the first version information in the second version information table that corresponds to the first rule information based on the first rule information and this correspondence.

[0157] Optionally, the virtual switch stores a relationship table indicating the correspondence between at least one rule identifier and at least one version index. Optionally, the relationship table includes a first correspondence, which is the correspondence between a first rule identifier and a first version index. The virtual switch determines the first version index based on the first rule identifier and the relationship table, and then determines the first version information containing the first version index. That is, the virtual switch determines the version information of the first version index corresponding to the first rule identifier as the first version information based on the first rule identifier and the first correspondence.

[0158] For example, with Figure 4A For example, the relationship table stores the correspondence between rule 1 and version information 1 in table 1, the correspondence between rule 2 and version information 1 in table 1, the correspondence between rule 1 and version information 2 in table 2, the correspondence between rule 2 and version information 1 in table 2, and so on. If the first rule information indicates that the rule that needs to be updated is rule 1 in table 1, then the virtual switch determines the corresponding version information 1 in the second version information table based on the relationship table.

[0159] It should be noted that the association table in the virtual switch can be generated when the virtual switch first creates an entry for a flow. Taking the first packet belonging to the first data flow as the fourth packet as an example, the virtual switch, based on the first data flow identifier of the received fourth packet, determines that there is no entry in the flow table corresponding to the first data flow identifier before the update. Therefore, the virtual switch generates the first version information in the version information table based on the first processing rule, and generates the first entry, which includes the first data flow identifier and the first version information. Then, the virtual switch generates the first correspondence based on the first rule identifier of the first processing rule and the first version index of the first version information, and stores the first correspondence in the association table. That is, when initially creating an entry for a flow, the virtual switch first determines which version information in the version information table the generated entry references, and then establishes the association between the referenced version information and the rule used to generate the entry. Therefore, when a rule changes, the virtual switch can accurately find the version information associated with that rule, and then update the version information to invalidate the entry related to that version information.

[0160] For example, such as Figure 4A As shown, if the virtual switch generates entry 1 based on rule 1 in table 1 and rule 2 in table 2, and this entry 1 references version information 1 in the second version information table, then the virtual switch generates a correspondence 1 between rule 1 in table 1 and version information 1, and generates a correspondence 2 between rule 2 in table 2 and version information 1, and stores the aforementioned correspondence 1 and correspondence 2 in the association table. When rule 1 in table 1 or rule 2 in table 2 changes, the virtual switch can quickly find version information 1 based on the aforementioned correspondence 1 and correspondence 2 in the association table.

[0161] Step 303: The virtual switch updates the version value of the first version information in the second version information table to obtain the second version information.

[0162] For example, the first version information includes a first version index and a first version value. The virtual switch updates the version value corresponding to the first version index to obtain a second version value corresponding to the first version index. This second version value is different from the first version value. The first version index and the second version value constitute the second version information.

[0163] For example, such as Figure 4A As shown, if version information 1 in the second version information table includes version index 1 (e.g., version_index = 1) and version value 1 (e.g., version_val = 2), then... Figure 4B As shown, the virtual switch updates the version value of version information 1 to obtain the updated version information 1', which includes version index 1 (e.g., version_index = 1) and version value 2 (e.g., version_val = 3), and replaces version information 1 with the updated version information 1'.

[0164] Step 304: The virtual switch sends the second version information to the network interface card (NIC); correspondingly, the NIC receives the second version information from the virtual switch.

[0165] Optionally, the second version information sent by the virtual switch to the network interface card (NIC) is used to indicate that the currently effective version of the first entry has changed. For example, the first rule information is the information used when generating the first entry. When the first rule information changes, the first entry becomes invalid, and a new entry for the first data stream needs to be generated. Therefore, the virtual switch sending the second version information to the NIC also indirectly indicates that the currently effective version of the first entry has changed.

[0166] For example, such as Figure 4B As shown, after the virtual switch updates version information 1 to version information 1', the virtual switch sends version information 1' (i.e., version index 1 (e.g., version_index = 1) and version value 2 (e.g., version_val = 3)) to the network card.

[0167] It should be noted that when the virtual switch updates multiple version information in the second version information table, the virtual switch can send the updated version information table to the network card, which includes the aforementioned second version information.

[0168] Step 305: The network card updates the second version information into the first version information table to obtain the updated first version information table.

[0169] The first version information table is the version information table stored by the network interface card (NIC). The first version information table includes at least one version information. It is determined by the NIC based on the version information issued by the virtual switch. For example, before the NIC receives the second version information, the first version information table (i.e., the first version information table before the update) stores the first version information, which is the version information referenced by the virtual switch when generating the first data flow pair's entry (i.e., the first entry). After the NIC receives the second version information, it replaces the first version information in the first version information table with the second version information. In other words, the updated first version information table includes the second version information but does not include the first version information.

[0170] For example, such as Figure 4B As shown, after the network card receives version information 1' (i.e., version index 1 (e.g., version_index=1) and version value 2 (e.g., version_val=3)), the network card updates the version information 1 (i.e., version index 1 (e.g., version_index=1) and version value 1 (e.g., version_val=2)) in the first version information table to version information 1' (i.e., version index 1 (e.g., version_index=1) and version value 2 (e.g., version_val=3)).

[0171] Step 306: The network card receives the first message.

[0172] The network interface card (NIC) parses the first received packet to obtain the parsing information of the first packet, which includes the first data stream identifier.

[0173] In this embodiment, step 306 is similar to step 201 above. Please refer to the relevant description in step 201 above for details, which will not be repeated here.

[0174] Step 307: The network interface card (NIC) determines the first entry corresponding to the first data stream based on the first data stream identifier and the first flow table. The first entry includes first version information.

[0175] The first flow table is the flow table stored in the network interface card (NIC), i.e., the hardware flow table in the NIC. The first entry includes a first data flow identifier and first version information. The first data flow identifier indicates the first data flow corresponding to the first entry, and the first version information is the version information referenced when the virtual switch generates the first entry. Furthermore, the first entry also includes a first action command corresponding to the first data flow.

[0176] For an explanation of the first stream table, the first table entry, the first data stream identifier, and the first version information, please refer to the relevant introduction in step 202 above, which will not be repeated here.

[0177] Step 308: The network card searches for the updated first version information table based on the first version information contained in the first table entry.

[0178] Since the updated first version information table includes second version information but not first version information, the network interface card (NIC) determines that the first entry in the current first flow table is no longer suitable for processing the packet corresponding to the first data flow (e.g., the first packet). Therefore, the NIC will trigger step 309.

[0179] For example, such as Figure 4B As shown, if the first packet belongs to data flow 1, the entry retrieved by the network interface card (NIC) based on the first flow table includes information about data flow 1 and version information 1 (e.g., "version_index = 1, version_val = 2"). However, the NIC only finds version information 1' (e.g., "version_index = 1, version_val = 3") based on the version index of version information 1 (i.e., version_index = 1), meaning that the version values ​​of version information 1 and version information 1' are inconsistent. Therefore, the action instructions in the entry for data flow 1 are no longer suitable for processing packets belonging to data flow 1, and the NIC will execute step 309.

[0180] Step 309: The network interface card (NIC) sends the first message to the virtual switch; correspondingly, the virtual switch receives the first message from the NIC.

[0181] Because the version value corresponding to the first version index stored in the first entry of the network interface card (NIC) (i.e., the first version value) is different from the version value corresponding to the first version index stored in the first version information table (i.e., the second version value), meaning that the version of the first entry in the NIC at the current moment is inconsistent with the version stored in the first version information table, it indicates that the NIC only obtained the updated version information table from the virtual switch, but not the updated first flow table. Therefore, the first entry in the current first flow table regarding the first data flow is no longer suitable for processing the first packet. Consequently, the NIC sends the first packet to the virtual switch so that the virtual switch can process the first packet.

[0182] In this embodiment, when the first processing rule in the virtual switch changes, the first entry in the second flow table of the virtual switch (i.e., the entry related to the first processing rule) becomes invalid, meaning the first entry is no longer suitable for processing the packet corresponding to the first data flow (e.g., the first packet). At this time, the virtual switch updates the first version information corresponding to the first entry in the second version information table to obtain second version information, and sends this second version information to the network interface card (NIC). This causes the NIC to stop using the packet corresponding to the first data flow (e.g., the first packet) from the first entry in the first flow table because the first version information in the first entry of the first flow table is inconsistent with the newly issued second version information from the virtual switch. This not only achieves the effect of deleting the first entry in the first flow table in a short time, but also avoids the need to call a large number of deletion interfaces to delete the first entry according to traditional techniques, thus saving processing overhead on the virtual switch side.

[0183] Furthermore, after receiving the first packet, the virtual switch is able to process it. The following section will combine... Figure 5 The process of a virtual switch processing the first packet is described. For example... Figure 5 As shown, in this embodiment, the network interface card (NIC) and virtual switch mainly perform the following steps:

[0184] Step 501: The network interface card (NIC) sends a first message to the virtual switch; correspondingly, the virtual switch receives the first message from the NIC.

[0185] After receiving the first packet, the virtual switch can perform parsing processing on the first packet to obtain its parsing information. This parsing information includes a first data stream identifier, which indicates the first data stream corresponding to the first packet, meaning the first packet belongs to the first data stream. For an explanation of the parsing information and the first data stream identifier, please refer to the relevant description in step 201 above; it will not be repeated here.

[0186] Step 502: The virtual switch determines the first entry corresponding to the first data flow based on the first data flow identifier and the second flow table. The first entry includes first version information.

[0187] The second flow table is a flow table stored by the virtual switch, specifically a software flow table generated by the virtual switch. This second flow table includes a first entry for the first data flow, which includes the first data flow identifier and first version information. For an explanation of the second flow table, the first entry, and the first version information, please refer to the relevant description in step 301 above; it will not be repeated here.

[0188] In this embodiment, since the first data stream identifier indicates that the first packet belongs to the first data stream, the virtual switch can find the first table entry that matches the first data stream identifier based on the first data stream identifier, and then obtain the first version information contained in the first table entry.

[0189] Step 503: The virtual switch looks up the second version information table based on the first version information.

[0190] The second version information table includes at least one version information entry, with each version information entry corresponding to at least one entry in the second flow table. For an explanation of the second version information table and version information, please refer to the relevant description in step 302 above; it will not be repeated here.

[0191] Since the virtual switch updated the version value of the first version information in the second version information table and obtained the second version information in step 303 above, the first version value of the first version information and the second version value of the second version information are inconsistent. Therefore, the virtual switch did not find a match when it looked up the second version information table based on the first version information.

[0192] If the virtual switch fails to find the second version information table based on the first version information, the virtual switch will execute step 504.

[0193] Step 504: The virtual switch generates a second entry based on the updated rule table.

[0194] Specifically, the virtual switch generates a second entry corresponding to the first data flow based on at least one processing rule in the updated rule table, where at least one processing rule includes the updated first processing rule. The second entry generated by the virtual switch includes a first data flow identifier and second version information. The first data flow identifier indicates the first data flow corresponding to the second entry, and the second version information is the version information referenced by the virtual switch when generating the second entry. The version value of the second version information differs from the version value of the first version information, but the version index of the second version information is the same as the version index of the first version information. For example, the first version information includes a first version index and a first version value, and the second version information includes a second version index and a second version value. Optionally, the second entry also includes a second action instruction for the first data flow, which instructs how to process packets belonging to the first data flow. This second action instruction may differ from the first action instruction in the first entry. For example, the first action instruction instructs packets belonging to the first data flow to be forwarded from port A, and the second action instruction instructs packets belonging to the first data flow to be forwarded from port B.

[0195] Optionally, the second entry includes a second matching field and a second action field, the first data stream identifier is located in the second matching field, the second action instruction corresponding to the first data stream is located in the second action field, and the second version information is located in the second action field or the second matching field.

[0196] After the virtual switch generates the second entry, it will execute steps 505 to 506. At the same time, it will also execute step 507.

[0197] Step 505: The virtual switch updates the second flow table based on the second entry, which replaces the first entry in the second flow table.

[0198] For example, a virtual switch replaces the first entry with a second entry to obtain an updated second flow table. The updated second flow table includes a second entry, which includes a first data flow identifier, a second action command corresponding to the first data flow, and second version information.

[0199] For example, such as Figure 4C As shown, the virtual switch generates a new entry for data flow 1 (i.e., Figure 4C The table entry shown is 1', which includes the identifier of data stream 1 and version information 1', which includes version index 1 and version value 2.

[0200] It should be noted that if the first version information in the second version information table is referenced by multiple entries, the virtual switch can generate multiple data stream entries after updating the first version information in the second version information table to the second version information. For example, ... Figure 4C As shown, if the virtual switch also receives a packet belonging to data flow 2, and the virtual switch finds a match in the second flow table but fails to find a match in the second version information table based on this packet, then the virtual switch will also generate a new entry for data flow 2 (i.e., Figure 4C (Table item 2' shown).

[0201] Step 506: The virtual switch processes the first packet based on the action command in the second table entry.

[0202] For example, the virtual switch processes the first packet based on the second action instruction corresponding to the first data stream.

[0203] Step 507: The virtual switch sends a second entry to the network interface card (NIC); correspondingly, the NIC receives the second entry from the virtual switch.

[0204] For example, such as Figure 4C As shown, the virtual switch sends entry 1' (i.e., the new entry for data flow 1) and entry 2' (i.e., the new entry for data flow 2) to the network card.

[0205] Step 508: The network interface card updates the first flow table based on the second entry, whereby the second entry replaces the first entry in the first flow table.

[0206] For example, the network interface card (NIC) replaces the first entry with the second entry to obtain the updated first flow table. The updated first flow table includes the second entry, which includes the first data flow identifier, the second action command corresponding to the first data flow, and the second version information.

[0207] Subsequently, if the network card receives another packet belonging to the first data stream, the network card can process the packet based on the action instructions in the second entry.

[0208] For example, the network interface card (NIC) receives a second packet and obtains its parsing information. This parsing information includes a first data stream identifier, which indicates that the second packet corresponds to a first data stream. Then, the NIC determines a second entry corresponding to the first data stream based on the first data stream identifier and an updated first flow table. This second entry includes the first data stream identifier, a second processing instruction, and second version information. The NIC then searches the first version information table based on the second version information in the second entry. Since the first version information table includes the second version information, if the NIC finds a match in the first version information table based on the second version information, the NIC processes the second packet based on the second action instruction corresponding to the first data stream.

[0209] In this embodiment, for a newly created data flow (e.g., the aforementioned first data flow), the virtual switch can generate a second entry for that data flow based on an updated rule table. This second entry includes the first data flow identifier and second version information. Then, the virtual switch sends this second entry to the network interface card (NIC) so that the NIC can replace the first entry in the first flow table with the second entry. At this time, the second entry in the first flow table of the NIC contains the second version information, and the first version information table of the NIC also contains the second version information. That is, for the same data flow, the version information in the first flow table (i.e., the second version information contained in the second entry) and the version information in the first version information table (i.e., the second version information in the first version information table) are consistent, indicating that the second entry is effective. Therefore, after receiving a packet belonging to the first data flow, the NIC can process the packet belonging to the first data flow based on the action instructions in the second entry. This facilitates transferring the processing load from the virtual switch side to the NIC, saving processing overhead on the virtual switch side.

[0210] like Figure 6The diagram shown is a structural schematic of a data processing unit 60 provided in an embodiment of this application. The data processing unit 60 can be a network interface card (e.g., a smart network interface controller (SmartNIC) or a data processing unit (DPU) card), etc., and this embodiment is not limited to this. (The foregoing...) Figure 2 , Figure 3 or Figure 5 The corresponding method implementations can all be based on Figure 6 The structure of the data processing unit 60 shown.

[0211] The data processing unit 60 includes multiple functional modules. These modules can be integrated into one processing unit, exist as separate physical units, or be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0212] Specifically, the data processing unit 60 includes a processing module 601 and a transceiver module 602. The transceiver module 602 receives a first message; the processing module 601 obtains first version information corresponding to a first data stream identifier in a flow table and second version information corresponding to the first data stream identifier in a version information table. The first data stream identifier identifies the data stream to which the received first message belongs, and the first version information is located in a first entry in the flow table corresponding to the first data stream identifier. The processing module 601 also triggers the transceiver module 602 to send the first message to the virtual forwarding device when it determines that the first version information and the second version information are different. Furthermore, the transceiver module 602 receives the first data stream identifier and the second version information from the virtual forwarding device. The processing module 601 uses the first data stream identifier and the second version information to update the first entry to obtain a second entry, which includes the first data stream identifier and the second version information.

[0213] In one possible implementation, the processing module 601 is used to determine a second entry in the flow table corresponding to the first data flow identifier based on the first data flow identifier obtained from the second message, wherein the second message and the first message belong to the same data flow; and to determine that the second version information included in the second entry is the same as the second version information corresponding to the first data flow identifier in the version information table, and to process the second message based on the second entry.

[0214] In one possible implementation, the first version information includes a first version index and a first version value; the second version information includes a first version index and a second version value, wherein the second version value is different from the first version value.

[0215] In one possible implementation, the processing module 601 is specifically configured to obtain a first data stream identifier based on the received first message; and, based on the first data stream identifier and the flow table, obtain first version information from a first entry in the flow table corresponding to the first data stream identifier, wherein the first entry includes the first data stream identifier and the first version information.

[0216] In one possible implementation, the processing module 601 is specifically used to search the version information table based on the first version index contained in the first version information in the first table entry, and the version information contained in the first version index in the obtained version information table is the second version information.

[0217] In one possible implementation, the transceiver module 602 is further configured to receive second version information from the virtual forwarding device; the processing module 601 is further configured to update the version value corresponding to the first version index in the version information table based on the second version value contained in the second version information, so as to obtain an updated version information table containing the second version information.

[0218] In one possible implementation, the transceiver module 602 is further configured to receive a third message; the processing module 601 is further configured to, based on the second data stream identifier obtained from the third message, determine a third entry in the flow table corresponding to the second data stream identifier, the third entry including the second data stream identifier and first version information, the second data stream identifier being used to identify the data stream to which the third message belongs, the second data stream identifier being different from the first data stream identifier; and, obtain the second version information corresponding to the second data stream identifier in the version information table; and, determine that the first version information is different from the second version information, send the third message to the virtual forwarding device.

[0219] In one possible implementation, the transceiver module 602 is further configured to receive a second data stream identifier and a second version information from the virtual forwarding device; the processing module 601 is configured to update a third entry based on the second data stream identifier and the second version information to obtain a fourth entry, the fourth entry including the second data stream identifier and the second version information.

[0220] In one possible implementation, the processing module 601 is used to look up the version information table based on the first version index contained in the first version information in the third table entry, and the version information contained in the first version index in the obtained version information table is the second version information.

[0221] In the above embodiments, each functional module in the data processing unit 60 can be implemented entirely or partially through software, hardware, firmware, or any combination thereof, and this embodiment is not limited thereto. For the beneficial effects of the actions performed by the aforementioned functional modules, please refer to the preceding description, which will not be repeated here.

[0222] like Figure 7The diagram shown is a structural schematic of a virtual forwarding device 70 provided in an embodiment of this application. The virtual forwarding device 70 can be a virtual machine or a virtual switch, etc., and this embodiment is not limited thereto. (The preceding text is incomplete and requires further context.) Figure 2 , Figure 3 or Figure 5 The corresponding method implementations can all be based on Figure 7 The structure of the virtual forwarding device 70 shown.

[0223] The virtual forwarding device 70 includes multiple functional modules. These modules can be integrated into a single processing unit, exist as separate physical units, or be integrated into a single unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0224] Specifically, the virtual forwarding device 70 includes a processing module 701 and a transceiver module 702. The processing module 701 is used to determine a second entry in the flow table corresponding to the first message based on the first message from the data processing unit. The second entry includes a first data flow identifier and second version information. The first data flow identifier is used to identify the data flow to which the first message belongs. The transceiver module 702 is used to send the first data flow identifier and the second version information to the data processing unit.

[0225] In one possible implementation, the processing module 701 is further configured to:

[0226] Based on the first data stream identifier of the first message, a first entry corresponding to the first data stream identifier is determined in the flow table before the update. The first entry includes the first data stream identifier and first version information. Based on the first version information, a second version information corresponding to the first data stream identifier is determined in the version information table. If the first version information and the second version information are different, the virtual forwarding device generates a second entry, which includes the first data stream identifier and the second version information. Based on the second entry, the flow table is updated, and the second entry is used to replace the first entry in the flow table.

[0227] In one possible implementation, the first version information includes a first version index and a first version value; the second version information includes a first version index and a second version value, wherein the first version value is different from the second version value.

[0228] In one possible implementation, the processing module 701 is used to look up the version information table based on the first version index contained in the first version information in the first table entry, and the version information contained in the first version index in the obtained version information table is the second version information.

[0229] In one possible implementation, the processing module 701 is used to generate a second entry based on the first rule information, the first rule information being used to update the first processing rule in the virtual forwarding device, the first processing rule being related to the first entry in the flow table in the virtual forwarding device.

[0230] In one possible implementation, the transceiver module 702 is used to acquire first rule information; the processing module 701 is used to determine, based on the first rule information, the version information related to the first rule information in the version information table as the first version information; and to update the version value of the first version information in the version information table to obtain the second version information.

[0231] In one possible implementation, the transceiver module 702 is further configured to send the updated version information table to the data processing unit; or, send the second version information in the updated version information table to the data processing unit.

[0232] In one possible implementation, the first rule information includes a first rule identifier; the virtual forwarding device stores a first correspondence, which is the correspondence between the first rule identifier and the first version index. The processing module 701 is specifically used to determine, based on the first rule identifier and the first correspondence, the version information of the first version index corresponding to the first rule identifier as the first version information.

[0233] In one possible implementation, the processing module 701 is used to process the first message based on the action instruction in the second entry.

[0234] In one possible implementation, the processing module 701 is configured to determine, based on the first data stream identifier of the received fourth message, that there is no entry in the flow table before the update that corresponds to the first data stream identifier, wherein the fourth message is the first message in the data stream indicated by the first data stream identifier; and to generate first version information in the version information table based on the first processing rule, and to generate a first entry, wherein the first entry includes the first data stream identifier and the first version information.

[0235] In one possible implementation, the processing module 701 is further configured to generate a first correspondence based on the first rule identifier of the first processing rule and the first version index of the first version information; the processing module 701 is further configured to control the storage module to store the first correspondence in the association table.

[0236] In the above embodiments, each functional module in the virtual forwarding device 70 can be implemented entirely or partially through software, hardware, firmware, or any combination thereof, and this embodiment is not limited thereto. For the beneficial effects of the actions performed by the aforementioned functional modules, please refer to the preceding description, which will not be repeated here.

[0237] like Figure 8The diagram shown is a structural schematic of a network device 80 provided in an embodiment of this application. The network device 80 can be a physical computer, as described above. Figure 2 , Figure 3 or Figure 5 In the corresponding method embodiment, the virtual forwarding device operates in the aforementioned network device 80.

[0238] The network device 80 includes at least one processor 801 and at least one memory 802. It should be understood that... Figure 8 Only one processor 801 and one memory 802 are shown.

[0239] The processor 801 can be a general-purpose central processing unit (CPU), a microprocessor, a network processor (NP), or an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of programs according to the present application. The processor 801 can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor 801 can refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions). Furthermore, the processor 801 can be a standalone semiconductor chip or integrated with other circuits into a single semiconductor chip. For example, it can form a system-on-a-chip (SoC) with other circuits (such as encoding / decoding circuits, hardware acceleration circuits, or various bus and interface circuits), or it can be integrated as a built-in processor within an application-specific integrated circuit (ASIC). This ASIC with integrated processor can be packaged separately or together with other circuits.

[0240] Furthermore, the aforementioned memory 802 can be a read-only memory (ROM), or other types of static storage devices capable of storing static information and instructions, or random access memory (RAM), or other types of dynamic storage devices capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM); the specific type is not limited here. The memory 802 can exist independently, but is connected to the aforementioned processor 801. Optionally, the memory 802 can also be integrated with the aforementioned processor 801. For example, it can be integrated into one or more chips.

[0241] Furthermore, the memory 802 is also used to store program code that executes the technical solutions of the embodiments of this application. The aforementioned program code can be controlled and executed by the processor 801, and the various types of computer program code being executed can also be considered as drivers for the processor 801. Therefore, the processor 801 can run the aforementioned virtual machine manager to provide the parsed information to multiple message processing modules within the virtual machine manager, wherein the multiple message processing modules are used to perform corresponding message processing on the message according to the parsed information.

[0242] In addition, the network device 80 also includes a data processing unit (not shown), which may be integrated into the aforementioned processor 801 or exist independently but is connected to the aforementioned processor 801. Optionally, the network device 80 also includes a communication interface 803 for communicating with other network devices. Optionally, the aforementioned data processing unit may be an external network interface card (NIC), which is connected to the aforementioned processor 801 through the communication interface 803.

[0243] For details on the functions implemented by this data processing unit, please refer to the preceding text. Figure 6 The relevant descriptions in the corresponding embodiments are not repeated here. Please refer to the preceding text for the functions implemented by this virtual forwarding device. Figure 7 The relevant descriptions in the corresponding embodiments will not be repeated here.

[0244] Furthermore, this application provides a computer program product comprising one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. For example, implementing the aforementioned... Figure 2 , Figure 3 or Figure 5 Methods related to the data processing unit (or network interface card) in the network. For example, implementing the methods described above. Figure 2, Figure 3 or Figure 5 Methods related to virtual forwarding devices (or virtual switches) in [the context of a computer]. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can store, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).

[0245] Furthermore, this application also provides a computer-readable storage medium storing a computer program that is executed by a processor to perform the aforementioned functions. Figure 2 , Figure 3 or Figure 5 Methods related to the data processing unit (or network card) in the network.

[0246] Furthermore, this application also provides a computer-readable storage medium storing a computer program that is executed by a processor to perform the aforementioned functions. Figure 2 , Figure 3 or Figure 5 Methods related to virtual forwarding devices (or virtual switches) in the context of [the topic].

[0247] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0248] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

Claims

1. A message processing method, characterized in that, include: The data processing unit obtains the first version information corresponding to the first data stream identifier in the flow table and the second version information corresponding to the first data stream identifier in the version information table. The first data stream identifier is used to identify the data stream to which the received first message belongs. The first version information is located in the first entry in the flow table corresponding to the first data stream identifier. The data processing unit determines that the first version information is different from the second version information, and sends the first message to the virtual forwarding device. The data processing unit updates the first entry to obtain a second entry based on the first data stream identifier and the second version information sent by the virtual forwarding device. The second entry includes the first data stream identifier and the second version information.

2. The method according to claim 1, characterized in that, The method further includes: The data processing unit determines the second entry in the flow table corresponding to the first data flow identifier based on the first data flow identifier obtained from the second message, wherein the second message and the first message belong to the same data flow. The data processing unit determines that the second version information included in the second table entry is the same as the second version information corresponding to the first data stream identifier in the version information table, and processes the second message based on the second table entry.

3. The method according to claim 1 or 2, characterized in that, The first version information differs from the second version information in that: The first version information includes a first version index and a first version value; the second version information includes the first version index and a second version value, wherein the second version value is different from the first version value.

4. The method according to claim 3, characterized in that, The data processing unit obtains the first version information corresponding to the first data stream identifier in the flow table, including: The data processing unit obtains the first data stream identifier based on the received first message; The data processing unit obtains the first version information from the first table entry corresponding to the first data stream identifier in the flow table based on the first data stream identifier and the flow table. The first table entry includes the first data stream identifier and the first version information.

5. The method according to claim 4, characterized in that, The data processing unit obtains the second version information corresponding to the first data stream identifier from the version information table, including: The data processing unit searches the version information table based on the first version index contained in the first version information in the first table entry, and the version information in the obtained version information table containing the first version index is the second version information.

6. The method according to claim 4 or 5, characterized in that, Before the data processing unit obtains the second version information corresponding to the first data stream identifier in the version information table, the method further includes: The data processing unit receives the second version information from the virtual forwarding device; The data processing unit updates the version value corresponding to the first version index in the version information table based on the second version value contained in the second version information, thereby obtaining an updated version information table containing the second version information.

7. The method according to any one of claims 4 to 6, characterized in that, The method further includes: The data processing unit determines a third entry in the flow table corresponding to the second data flow identifier based on the second data flow identifier obtained from the third message. The third entry includes the second data flow identifier and the first version information. The second data flow identifier is used to identify the data flow to which the third message belongs. The second data flow identifier is different from the first data flow identifier. The data processing unit obtains the second version information corresponding to the second data stream identifier from the version information table; The data processing unit determines that the first version information is different from the second version information, and sends the third message to the virtual forwarding device.

8. The method according to claim 7, characterized in that, The method further includes: The data processing unit receives the second data stream identifier and the second version information from the virtual forwarding device; The data processing unit updates the third entry based on the second data stream identifier and the second version information to obtain a fourth entry, the fourth entry including the second data stream identifier and the second version information.

9. The method according to claim 7 or 8, characterized in that, The data processing unit obtains the second version information corresponding to the second data stream identifier from the version information table, including: The data processing unit searches the version information table based on the first version index contained in the first version information in the third table entry, and the version information in the obtained version information table containing the first version index is the second version information.

10. The method according to any one of claims 1 to 9, characterized in that, The data processing unit is a network interface card (NIC) or a digital processing unit (DPU), and the virtual forwarding device is a virtual switch or a virtual machine (VM).

11. A message processing method, characterized in that, include: The virtual forwarding device determines a second entry in the flow table corresponding to the first packet based on the first packet from the data processing unit. The second entry includes a first data flow identifier and second version information. The first data flow identifier is used to identify the data flow to which the first packet belongs. The virtual forwarding device sends the first data stream identifier and the second version information to the data processing unit.

12. The method according to claim 11, characterized in that, Before the virtual forwarding device determines the second entry in the flow table corresponding to the first packet based on the first packet from the data processing unit, the method further includes: The virtual forwarding device determines the first entry in the flow table before the update that corresponds to the first data flow identifier based on the first data flow identifier of the first packet. The first entry includes the first data flow identifier and the first version information. The virtual forwarding device determines the second version information corresponding to the first data stream identifier in the version information table based on the first version information; The virtual forwarding device determines that the first version information is different from the second version information, and the virtual forwarding device generates a second entry, which includes the first data stream identifier and the second version information. The virtual forwarding device updates the flow table based on the second entry, whereby the second entry replaces the first entry in the flow table.

13. The method according to claim 12, characterized in that, The first version information differs from the second version information in that: The first version information includes a first version index and a first version value; the second version information includes a first version index and a second version value, wherein the first version value is different from the second version value.

14. The method according to claim 13, characterized in that, The virtual forwarding device determines the second version information corresponding to the first data stream identifier in the version information table based on the first version information, including: The virtual forwarding device searches the version information table based on the first version index contained in the first version information in the first table entry, and the version information in the obtained version information table containing the first version index is the second version information.

15. The method according to any one of claims 12 to 14, characterized in that, The virtual forwarding device generates a second entry, including: The virtual forwarding device generates the second entry based on the first rule information, the first rule information being used to update the first processing rule in the virtual forwarding device, and the first processing rule being related to the first entry in the flow table in the virtual forwarding device.

16. The method according to claim 15, characterized in that, Before the virtual forwarding device determines the first entry in the flow table corresponding to the first data flow identifier based on the first data flow identifier of the first packet, the method further includes: The virtual forwarding device acquires the first rule information; The virtual forwarding device determines, based on the first rule information, the version information related to the first rule information in the version information table as the first version information; The virtual forwarding device updates the version value of the first version information in the version information table to obtain the second version information.

17. The method according to claim 16, characterized in that, The method further includes: The virtual forwarding device sends the updated version information table to the data processing unit; or... The virtual forwarding device sends the second version information from the updated version information table to the data processing unit.

18. The method according to claim 16 or 17, characterized in that, The first rule information includes a first rule identifier; the virtual forwarding device stores a first correspondence, which is the correspondence between the first rule identifier and the first version index; The virtual forwarding device determines, based on the first rule information, the version information related to the first rule information in the version information table as the first version information, including: The virtual forwarding device determines the version information of the first version index corresponding to the first rule identifier as the first version information based on the first rule identifier and the first correspondence.

19. The method according to any one of claims 12 to 18, characterized in that, The method further includes: The virtual forwarding device processes the first message based on the action command in the second entry.

20. The method according to any one of claims 16 to 19, characterized in that, Before the virtual forwarding device obtains the first rule information, the method further includes: The virtual forwarding device determines, based on the first data stream identifier of the received fourth message, that there is no entry in the flow table before the update that corresponds to the first data stream identifier, and the fourth message is the first message in the data stream indicated by the first data stream identifier; The virtual forwarding device generates the first version information in the version information table based on the first processing rule, and generates the first table entry, which includes the first data stream identifier and the first version information.

21. The method according to claim 20, characterized in that, The method further includes: The virtual forwarding device generates the first correspondence based on the first rule identifier of the first processing rule and the first version index of the first version information; The virtual forwarding device stores the first correspondence in an association table.

22. A data processing unit, characterized in that, The data processing unit includes a module for performing the method as described in any one of claims 1 to 10.

23. A virtual forwarding device, characterized in that, The virtual forwarding device includes a module for performing the method as described in any one of claims 11 to 21.