Packet processing method, physical host, virtual switch, medium and product

By configuring data allocation rules in the software forwarding module of the virtual switch, allocating the packet to the receiving queue of the target virtual network card based on the metadata of the data packet, and processing it by the bound processor core, the problem of unbalanced packet processing is solved and efficient packet allocation and processing is achieved.

CN119676199BActive Publication Date: 2025-08-05ALIBABA CLOUD COMPUTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510167809.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-14
Publication Date
2025-08-05
Estimated Expiration
2045-02-14

AI Technical Summary

Technical Problem

In network communication, how to reasonably allocate data packets to different receiving queues to improve processing efficiency, especially in multiprocessor core devices, how to optimize the load imbalance of data packet processing.

Method used

By configuring data allocation rules in the software forwarding module of the virtual switch, it is allocated to the receiving queue of the target virtual network card according to the metadata of the data packet, and is processed by the bound processor core, it supports multi-queue reception methods, improving the flexibility and convenience of data packet allocation.

Benefits of technology

It realizes reasonable allocation of data packets, improves processing efficiency, and does not need to reconfigure queue allocation rules when virtual instances are hotly migrated, improving system flexibility and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119676199B_ABST
    Figure CN119676199B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data packet processing method, a physical host, a virtual switch, a medium, and a product. After a data packet is acquired by the virtual switch, a software forwarding module in the virtual switch can, according to a locally stored data distribution rule and metadata of the data packet, distribute the data packet to a target receive queue configured for a virtual network card in a virtual instance, so that the data packet is processed by a processor core bound to the target receive queue, that is, multi-queue reception of the data packet is implemented. In the above process, the process of distributing the data packet using the data distribution rule is implemented by a software module. Compared with configuring the data distribution rule in a hardware module, richer data distribution rules can be configured in the software module, making the distribution of data packets more reasonable. Moreover, when hot migration of the virtual host occurs, the data distribution rules configured in the software module can be directly hot migrated, eliminating the process of reconfiguring the data distribution rules on the new physical host.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud networks, and in particular, to a data packet processing method, a physical host, a virtual switch, a medium, and a product. Background Art

[0002] In the process of network communication, for a device configured with multiple processor cores (usually CPU cores), when in the Receive Side Scaling (RSS) mode, for the received data packets, the data packets can be scattered into different receive queues (Receive Queues), so that different processor cores can process the data packets in different receive queues respectively. That is, the data packets are processed by adopting the multi-queue receiving method, which can improve the data packet processing efficiency while also improving the situation of excessive load on a single processor core.

[0003] In practice, how to reasonably allocate data packets to different receive queues becomes an urgent problem to be solved. Summary of the Invention

[0004] In view of this, multiple aspects of this application provide a data packet processing method, a physical host, a virtual switch, a medium, and a product, so as to improve the rationality of data packet allocation and the data packet processing efficiency.

[0005] An embodiment of this application provides a data packet processing method. The physical host includes multiple processor cores. A virtual switch and virtual machines are deployed in the physical host. The virtual instance includes at least one virtual network card, and any virtual network card is configured with multiple receive queues. The method is applied to a software forwarding module in the virtual switch, and the method includes:

[0006] Determine a target virtual network card in the virtual instance according to the metadata of the first data packet;

[0007] Determine a target data allocation rule corresponding to the target virtual network card in the alternative data allocation rules stored in the software forwarding module;

[0008] According to the target data allocation rule, determine a target receive queue among the multiple queues configured by the target virtual network card, so that the target processor core bound to the target receive queue processes the first data packet.

[0009] An embodiment of this application provides a physical host, including: multiple processor cores, a manager, a virtual switch, and a virtual instance running in the physical host. At least one virtual network card in the virtual instance is respectively configured with multiple receive queues. The virtual switch includes a software forwarding module and an input / output module;

[0010] The virtual instance is configured to send the alternative data distribution rule corresponding to the rule configuration operation to the manager if a rule configuration operation for different virtual network cards in the virtual instance is monitored.

[0011] The manager is configured to send the alternative data distribution rule to the software forwarding module.

[0012] The software forwarding module is configured to, in response to receiving a first data packet, determine a target virtual network card in the virtual instance according to the metadata of the first data packet; determine a target data distribution rule corresponding to the target virtual network card in the alternative data distribution rules; and determine a target receiving queue from among multiple receiving queues configured for the target virtual network card according to the target data distribution rule.

[0013] The input / output module is configured to place the first data packet into the target receiving queue.

[0014] A target processor core bound to the target receiving queue is configured to read and process the first data packet from the target queue.

[0015] An embodiment of the present application provides a virtual switch, including: a software forwarding module, a hardware forwarding module, and an input / output module.

[0016] The hardware forwarding module is configured to receive a first data packet; and if the flow table stored in the hardware forwarding module does not contain the metadata of the first data packet, send the first data packet to the software forwarding module.

[0017] The software forwarding module is configured to store alternative data distribution rules; determine a target data distribution rule corresponding to the target virtual network card in the alternative data distribution rules; in response to receiving the first data packet, determine a target virtual network card in the virtual instance according to the metadata of the first data packet; and determine a target receiving queue from among multiple receiving queues configured for the target virtual network card according to the target data distribution rule.

[0018] The input / output module is configured to place the first data packet into the target receiving queue.

[0019] An embodiment of the present application provides a data packet processing device, which may be the software forwarding module in a virtual switch. The virtual instance includes at least one virtual network card, and each virtual network card is configured with multiple receiving queues. The virtual switch and the virtual instance are deployed on the same physical host, and the physical host includes multiple processor cores.

[0020] The device includes:

[0021] A network card determination module, configured to determine a target virtual network card in the virtual instance according to metadata of a first data packet;

[0022] A rule determination module, configured to determine a target data distribution rule corresponding to the target virtual network card from alternative data distribution rules stored in the software forwarding module;

[0023] A queue determination module, configured to determine a target receiving queue from multiple queues configured for the target virtual network card according to the target data distribution rule, so that a target processor core associated and bound with the target receiving queue processes the first data packet.

[0024] An embodiment of the present application provides an electronic device, including a processor and a memory. The memory is used to store one or more computer instructions. When the one or more computer instructions are executed by the processor, the above-mentioned data packet processing method is implemented. The electronic device may further include a communication interface for communicating with other devices or communication networks.

[0025] An embodiment of the present application provides a non-transitory machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor of an electronic device, the processor can at least implement the data packet method as described above.

[0026] An embodiment of the present application provides a computer program product, which includes a computer program or instruction. When the computer program or instruction is executed by a processor, the processor can implement the data packet processing method as described above.

[0027] The data packet processing method provided by an embodiment of the present application can be applied to network communication in a virtualized network. In a virtualized network, virtual instances and virtual switches can be deployed on a physical host, and the physical host can further include multiple processor cores. A virtual instance can include at least one virtual network card. Then the data packet processing method may include: after a virtual switch receives a data packet, a software forwarding module in the virtual switch can allocate the data packet to a queue configured for a virtual network card according to locally stored data distribution rules and metadata of the data packet, so that a processor core bound to the queue processes the data packet.

[0028] During the above process, the software forwarding module in the virtual switch can use the multi-queue receiving method to allocate different data packets to different queues configured for the virtual network cards in the virtual instances, so that they can be processed by the processor cores respectively bound to the different queues. Compared with using hardware to implement data packet forwarding, the software forwarding module can improve the configuration flexibility and convenience of data distribution rules, making the data packet distribution more reasonable. Moreover, compared with using hardware to implement data packet forwarding, after the data distribution rules are directly configured in the software forwarding module, when the virtual instance is hot migrated to a new physical host, the data distribution rules can also be directly hot migrated, thus saving the process of reconfiguring the queue distribution rules on the new physical host. Brief Description of the Drawings

[0029] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments and descriptions thereof are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:

[0030] Figure 1a It is a schematic structural diagram of a physical host provided by an embodiment of the present application;

[0031] Figure 1b is Figure 1a a schematic diagram of the working process of the shown physical host;

[0032] Figure 2a It is another schematic structural diagram of a physical host provided by an embodiment of the present application;

[0033] Figure 2b is Figure 2a a schematic diagram of the working process of the shown physical host;

[0034] Figure 3 It is yet another schematic structural diagram of a physical host provided by an embodiment of the present application;

[0035] Figure 4 It is a schematic diagram of the data packet processing process in a cloud service scenario provided by an embodiment of the present application;

[0036] Figure 5 It is a schematic structural diagram of a virtual switch provided by an embodiment of the present application;

[0037] Figure 6 It is a flowchart of a data packet processing method provided by an embodiment of the present application;

[0038] Figure 7 It is a flowchart of another data packet processing method provided by an embodiment of the present application;

[0039] Figure 8A schematic structural diagram of a data packet processing device provided by an embodiment of the present application;

[0040] Figure 9 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0041] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the scope of protection of the present application.

[0042] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms of "a", "the" and "said" used in the embodiments of the present application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. "Multiple" generally includes at least two, but does not exclude the case of including at least one.

[0043] It should be understood that the term " / and" used herein is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the associated objects before and after.

[0044] Depending on the context, the words "if" and "when" used herein can be interpreted as "when...", "when...", "in response to determining" or "in response to recognizing". Similarly, depending on the context, the phrase "if determined" or "if recognized (stated condition or event)" can be interpreted as "when determined", "in response to determining", "when recognizing (stated condition or event)", or "in response to recognizing (stated condition or event)".

[0045] It should be noted that in the case where the embodiments of the present application involve user information, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties. The collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entrances are provided for the user to choose to authorize or refuse.

[0046] It should also be noted that the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a commodity or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or elements inherent to such commodity or system. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the commodity or system including the said element.

[0047] Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. Without conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step timings in the following method embodiments are only examples and not strictly limited.

[0048] And for the convenience of understanding the content of the solution, the processing process of data packets will be described below with reference to the internal structure of the physical host first. For specific content, reference can be made to the detailed description in the following Figures 1a to 3 illustrated embodiments.

[0049] Figure 1a The figure is a schematic structural diagram of a physical host provided by an embodiment of the present application. Figure 1b For Figure 1a the process of the illustrated physical host for processing data packets. The physical host is configured with multiple processor cores, and a virtual switch (abbreviated as vSwitch), virtual instances and a manager of the virtual instances can also run in the physical host, and will be simply referred to as the manager in the following embodiments. Optionally, multiple processor cores can be configured on the same physical host, and at least one virtual instance and at least one virtual switch can also be deployed. As Figure 1a shown, the physical host can be configured with N processor cores and M virtual instances, but there is no size relationship between M and N. The virtual instances and virtual switches running in the same or different physical hosts can be included in the virtualized network. The virtual switch can transmit data packets between different virtual instances, and the virtual instances can receive and process the data packets sent by the virtual switch, so as to implement network communication in the virtualized network.

[0050] Optionally, the virtual instance can specifically include a virtual machine (abbreviated as VM) or a container.

[0051] When the virtual instance is specifically a virtual machine, the virtual machine can serve as different network nodes in the virtualized network, such as a cloud server based on Elastic Compute Service (ECS). Optionally, any virtual instance can include at least one virtual network card, and each of the at least one virtual network card can be respectively configured with multiple receive queues. The virtual switch can include a forwarding module for determining the forwarding path and an input / output (I / O) module for forwarding data according to the forwarding path. Among them, the forwarding module can be implemented in the form of a software module. Therefore, it can also be called a software forwarding module, and the software forwarding module can include an instruction set for implementing packet forwarding for the CPU to execute. The I / O module can be implemented in hardware or software.

[0052] The manager of the virtual instance can manage the creation, configuration, start / stop, migration, etc. of the virtual instance.

[0053] When the virtual instance is a virtual machine, the manager of the virtual instance can specifically be a Virtual Machine Manager (VMM). Optionally, the manager can specifically include any one of a Kernel-Based Virtual Machine (KVM) or a Quick Emulator (QEMU), etc. Among them, optionally, when the virtual instance is specifically a virtual machine, the manager and the virtual machine can communicate through the high-speed communication path provided by the Peripheral Component Interconnect Express (PCIe) technology, such as transmitting data distribution rules. The manager and the software forwarding module in the virtual switch can communicate through shared memory, socket communication, or semaphore, etc.

[0054] When the virtual instance is a container, the manager is specifically a Container Runtime.

[0055] Optionally, data packets transmitted between different virtual instances can form a data stream. This data stream can be generated during the user's use of the services provided by the service provider. The service provider can provide services in the form of applications or cloud services. And data packets generated using different services can belong to different data streams. Also, depending on the service content, the content of the data packets is different. For example, when the service is cloud gaming, the data packets can include game data; when the service is cloud computing service, the data packets can include calculation results. Since the above-mentioned data streams require high processing timeliness, they can be called real-time data streams. In addition, data streams with low requirements for processing timeliness can be called batch data streams, such as the data streams used in model training in the cloud.

[0056] Based on the above introduction to each part in the physical host, the processing process of data packets by virtual instances in the physical host can be described as follows:

[0057] In response to the reception of the first data packet, the software forwarding module in the virtual switch can first determine the target virtual network card in the virtual instance according to the metadata of the first data packet, and then determine the target data allocation rule corresponding to the target virtual network card in the alternative data allocation rules locally stored in the software forwarding module. And according to the target data allocation rule, determine the target receiving queue among the multiple receiving queues configured for the target virtual network card. Finally, the I / O module in the virtual switch can put this first data packet into the target receiving queue configured for the target virtual network card in the virtual instance, so that the first data packet can be processed by the target processor core bound to the target receiving queue. As Figure 1b shown, the target virtual network card can be virtual network card 1, the target receiving queue can be queue P, and the target processor core can be processor core 2.

[0058] Among them, the metadata of the first data packet can include the five-tuple information of the first data packet. The five-tuple information can specifically include the source Internet Protocol (IP) address, destination IP address, source port number, destination port number, and protocol type. The five-tuple can also include four-tuple information, that is, the source IP address, destination IP address, source port number, and destination port number. Among them, there is a preset binding relationship between the receiving queues configured for the virtual network cards in the virtual instance and the multiple processor cores in the physical host. This binding relationship can be configured by the virtual instance manager during the process of creating the virtual instance.

[0059] Among them, considering that data packets belonging to different types of data streams can be assigned to receive queues configured by different virtual network cards in a virtual instance, optionally, for the data allocation rules corresponding to different virtual network cards included in the alternative data allocation rules, the software forwarding module needs to find the corresponding virtual network card and its data allocation rule from the alternative data allocation rules according to the metadata in the data packet that can reflect the data stream type to which the data packet belongs.

[0060] In addition, the alternative data allocation rules locally stored by the software forwarding module can be obtained before receiving the first data packet, and the obtaining process of the alternative data allocation rules can be as follows:

[0061] The virtual instance can use the listening tool or listening interface deployed by itself to listen for whether there is a rule configuration operation triggered by the user. When a rule configuration operation is detected, the alternative data allocation rule corresponding to the rule configuration operation can be sent to the manager. The manager can store the alternative data allocation rule by itself, and at the same time, the manager can further forward the alternative data allocation rule to the software forwarding module in the virtual switch so that the software forwarding module stores this alternative data allocation rule.

[0062] Optionally, the listening tool can be ethtool, and the listening interface can be the API interface included in the network data packet processing library. The network data packet processing library can be the Data Plane Development Kit (DPDK for short), and then the listening interface can be the rte_flow interface in DPDK. Optionally, both the manager and the virtual switch can run in the form of processes on the physical host. Therefore, the alternative data allocation rules can be transmitted from the virtual instance manager to the virtual switch through inter-process communication. Optionally, the manager can also store this alternative data allocation rule. Optionally, the rule configuration operation can be an operation triggered by the user for different virtual instances in different physical hosts.

[0063] For any data packet obtained by the virtual switch, the software forwarding module can determine a receiving queue in the above manner, that is, RSS is implemented in the virtual instance.

[0064] In this embodiment, after the virtual switch receives a data packet, the software forwarding module in the virtual switch can allocate the data packet to a queue configured by a virtual network card according to the locally stored data allocation rule and the metadata of the data packet, so that the data packet is processed by the processor core bound to the queue.

[0065] Optionally, after the virtual network card places the data packet into the corresponding receive queue, it will notify the processor core that a new data packet has arrived through a hardware interrupt, such as an Interrupt Request Line (IRQ for short). If the virtual network card supports Message Signaled Interrupt (MSI for short), it can directly send the interrupt to the bound processor core. After receiving the interrupt, the processor core will trigger the soft interrupt handler. The soft interrupt handler can then obtain the data packet from the receive queue and further process the data packet.

[0066] In the above process, the software forwarding module in the virtual switch can use the multi-queue receiving method to allocate different data packets to different queues configured by the virtual network cards in the virtual instances, so that they can be processed by the processor cores respectively bound to different queues. Compared with using hardware to implement data packet forwarding, the software forwarding module can improve the configuration flexibility and convenience of data distribution rules, making the distribution of data packets more reasonable. And compared with using hardware to implement data packet forwarding, after directly configuring the data distribution rules in the software forwarding module, when the virtual instance is hot migrated to a new physical host, the data distribution rules can also be directly hot migrated, thus saving the process of reconfiguring the queue distribution rules on the new physical host.

[0067] Optionally, since the data packets transmitted in the embodiments of the present application can be included in the data stream, the software forwarding module can also directly use the flow table to implement the forwarding of data packets to improve the forwarding speed.

[0068] Continued Figure 1a As described in the embodiments shown, when the virtual switch obtains the first data packet, it can first query in the locally stored flow table. If the five-tuple information in the metadata of the first data packet is not included in the locally stored flow table, indicating that the first data packet is the first data packet obtained by the virtual switch in a data stream, the software forwarding module in the virtual switch can continue to determine the target virtual network card and the target receive queue in sequence according to the Figure 1a way shown in the embodiments shown, and finally process the first data packet by the target processor core bound to the target receive queue. At the same time, optionally, the software forwarding module can also generate a target flow table including the five-tuple information of the first data packet, the identity identifier of the target virtual network card, and the identity identifier of the target receive queue.

[0069] After generating the target flow table, when the virtual switch receives a second data packet after the first data packet, the software forwarding module can directly query in the target flow table. If the five-tuple information of the second data packet is included in the target flow table, indicating that the second data packet and the first data packet belong to the same data stream, the software forwarding module can directly read the identity identifiers of the target virtual network card and the target receive queue from the target flow table, and the I / O module can put the second data packet into the target receive queue configured for the target virtual network card. If the five-tuple information of the second data packet is not included in the target flow table, indicating that the second data packet and the first data packet do not belong to the same data stream, the software forwarding module can continue to determine the receive queue for this second data packet in the manner shown in Figure 1a and generate a flow table for the data stream to which the second data packet belongs. Optionally, the target flow table may also include the four-tuple information of the data packet.

[0070] Based on Figure 1a the physical host shown, in this embodiment, for the data packet that arrives at the virtual switch first in the data stream, the software forwarding module can first determine the virtual network card and the receive queue for it, and then the I / O module performs data packet forwarding so that the corresponding processor core can process it. For the data packets that subsequently arrive at the virtual switch in the same data stream, the software forwarding module can directly query in the flow table to implement data packet forwarding, thereby improving the data packet forwarding speed.

[0071] On the basis of the above embodiments, optionally, the data packet forwarding speed can also be improved by means of hardware acceleration. Figure 2a Another structural schematic diagram of a physical host provided for the embodiment of the present application. Figure 2b For Figure 2a the process of the physical host shown in handling data packets. On the basis of the embodiment shown in Figure 1a , the virtual switch in this physical host may further include a hardware forwarding module. The hardware forwarding module may store flow tables generated by the software forwarding module for different data streams. That is, the flow table query process is offloaded to be executed in the hardware.

[0072] The data packets transmitted in the virtualized network can be preferentially acquired by the hardware forwarding module in the virtual switch. Then for Figure 2a the physical host with the structure shown, the processing process of the virtual instance in it for the data packets can be described as:

[0073] The hardware forwarding module in the virtual switch can obtain the first data packet. After that, the hardware forwarding module can first query in the locally stored flow table. If the target flow table containing the five-tuple information of the first data packet is not found in the local flow table, it indicates that the first data packet is the first data packet obtained by the virtual switch in the data stream to which the first data packet belongs. Then the hardware forwarding module can send the first data packet to the software forwarding module in the virtual switch, so that the software forwarding module can determine the target virtual network card and the target receiving queue in sequence, and the target processor core bound to the target receiving queue can process the first data packet. At the same time, the software forwarding module can also generate a target flow table containing the identity identifiers of the target virtual network card and the target receiving queue respectively, as well as the metadata of the first data packet, and further forward the target flow table to the hardware forwarding module.

[0074] After the first data packet, the hardware forwarding module in the virtual switch can also receive a second data packet. If the hardware forwarding module finds the target flow table in the locally stored flow table, it indicates that the second data packet belongs to the same data stream as the first data packet. Then the I / O module can directly forward the second data packet to the target receiving queue according to the target flow table found by the hardware forwarding module.

[0075] Optionally, the hardware forwarding module may include a programmable chip, such as a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), a Complex Programmable Logic Device (CPLD), etc. Optionally, the hardware forwarding module in the virtual switch can use the high-speed communication path provided by the PCIe technology to realize data transmission between the virtual instance and the software forwarding module respectively.

[0076] Based on Figure 2a For the physical host shown, in this embodiment, for the virtual switch that includes both a software forwarding module and a hardware forwarding module, the data packet can be first obtained by the hardware forwarding module, so that the hardware forwarding module can first query in the flow table. If the metadata of the data packet is not found in the flow table, it is necessary to rely on the software forwarding module and the I / O module to complete the data packet forwarding. If the metadata of the data packet is found in the flow table, the data packet forwarding can be directly completed using the flow table stored in the hardware forwarding module and the I / O module. In this case, directly querying the flow table can improve the forwarding efficiency of the data packet, and querying the flow table in the hardware forwarding module can further improve the forwarding efficiency.

[0077] In the physical host shown in each of the above embodiments, during the process of a virtual instance processing a data packet, the software forwarding module has a process of determining a target virtual network card according to metadata. For the determination of the target virtual network card, in an optional manner, the software forwarding module may also locally store a routing forwarding table, and the routing forwarding table may record an IP address and an identity identifier of the virtual network card. After receiving the first data packet, the software forwarding module may query the locally stored routing forwarding table according to the destination IP address of the first data packet. If the destination IP address in the first data packet is the same as the IP address recorded in the routing forwarding table, the virtual network card recorded in the routing forwarding table is determined as the target virtual network card. In another optional manner, the software forwarding module may store a correspondence relationship between the data flow type and the virtual network card. After receiving the first data packet, the software forwarding module may first determine the type of the data flow to which the first data packet belongs according to the metadata of the first data packet, and then determine the target virtual network card according to the correspondence relationship between the data flow type and the virtual network card.

[0078] In the physical host shown in each of the above embodiments, during the process of a virtual instance processing a data packet, the software forwarding module also has a process of determining a target data distribution rule. For the determination of the target data distribution rule, optionally, the software forwarding module may store the data distribution rules configured by the user for different virtual network cards in the virtual instance, so as to form the alternative data distribution rules mentioned in each of the above embodiments. After determining the target virtual network card, the software forwarding module may also find the target data distribution rule corresponding to the target virtual network card from the alternative data distribution rules.

[0079] In the physical host shown in each of the above embodiments, during the process of a virtual instance processing a data packet, the software forwarding module also has a process of determining a target receiving queue according to the target data distribution rule. And for the convenience of understanding how to determine the target receiving queue, the data distribution rule used in the process of determining the target receiving queue will be introduced below.

[0080] Users can configure different data distribution rules for different virtual network cards. Optionally, the data distribution rules for any virtual network card may include items such as preset operators, preset hash algorithms, and identification sequences. Among them, optionally, the preset hash algorithm may be any one of common hash algorithms such as a hash algorithm based on a Toeplitz matrix, a hash algorithm based on exclusive-or (xor) operation, a hash algorithm based on polynomial division such as Cyclic Redundancy Check 32, and so on. Optionally, the preset operator may be any one of variable-length 01-bit strings in the form of 6a:de:57:08:1f:5a:92:ee:2f:8f:16:d4:95:e6:a8:80:d1:a2:fd:2f:6c:ae:92:2e:38:06:33:0e:1d:44:44:45:31:8e:53:2f:05:d5:5a:00. The queue identifiers of the multiple receive queues configured for any virtual network card can be arranged and numbered sequentially according to the arrangement order. After sorting according to the number size, the identification sequence can be obtained. Optionally, the identification sequence can be stored in an indirection table.

[0081] For example, any virtual network card can be configured with 3 receive queues with queue identifiers 0, 1, and 2 respectively. The receive queue with queue identifier 0 can be numbered 0, 1, 2; the receive queue with queue identifier 1 can be numbered 3, 4, 5; the receive queue with queue identifier 2 can be numbered 6, 7, 8. Then the final identification sequence obtained can be [0, 0, 0, 1, 1, 1, 2, 2, 2].

[0082] It can be seen that the identification sequence can reflect information such as the arrangement order and occurrence frequency of queue identifiers, and the occurrence frequency of different queue identifiers in the identification sequence can also reflect the weight of the queue.

[0083] For example, any virtual network card can be configured with 3 receive queues with queue identifiers 0, 1, and 2 respectively. Then the layout of the queue identifiers of these three receive queues in the indirection table can be [0, 0, 0, 1, 1, 1, 2, 2, 2], or [0, 1, 2, 0, 1, 2, 0, 1, 2], or [0, 0, 0, 0, 1, 1, 1, 1, 2], etc. In the last layout, compared with the queues with queue identifier 0 or 1, the queue with queue identifier 2 has a lower weight.

[0084] Based on the above introduction of the data distribution rule, the determination process of the target receiving queue can be described as follows: After the software forwarding module receives the first data packet, the software forwarding module can first input the quadruple information in the metadata of the first data packet and the preset operator in the target data distribution rule into the preset hash algorithm to obtain the output result of the preset hash algorithm. For the output result expressed as a numerical value, the software forwarding module can further determine the identifier with the same number as the algorithm output result in the identifier sequence as the target identifier, and the queue with this target identifier is the target receiving queue. Continuing with the above example, the identifier sequence is [0, 0, 0, 1, 1, 1, 2, 2, 2], and the numbers of the queue identifiers in this identifier sequence are 0 to 8 in sequence. Then, when the algorithm output result is 5, the queue with the queue identifier 1 in this sequence can be determined as the target receiving queue.

[0085] Optionally, on the basis of including a preset operator, a preset hash algorithm, and an identifier sequence, the data distribution rule can further include a preset protocol type. Specifically, after the software forwarding module receives the first data packet and determines the target data distribution rule, it can further determine whether the protocol type in the five-tuple information of the first data packet is the same as the preset protocol type in the target data distribution rule. If the protocol type in the five-tuple information is the same as the preset protocol type in the target data distribution rule, the software forwarding module can further use other items in the target data distribution rule to determine the target receiving queue. Among them, the specific determination process of the target receiving queue is the same as that in the above embodiment and will not be repeated here.

[0086] In this embodiment, the software forwarding module can determine one receiving queue for receiving data packets from multiple receiving queues configured in the virtual network card according to different items in the data distribution rule.

[0087] According to the descriptions in the above embodiments, the data distribution rule is an important parameter for implementing RSS. And as the characteristics of data packets change and the data flow types become richer, optionally, the user can also update the data distribution rules set for different virtual network cards. Among them, the characteristics of data packets can include the generation speed of data packets, generation frequency, data packet size, and so on.

[0088] Specifically, when the user triggers a rule update operation on the target virtual network card in the virtual instance, the virtual instance can monitor this rule update operation and send the corresponding second data allocation rule to the manager. The manager can further forward the second data allocation rule to the software forwarding module in the virtual switch. The software forwarding module can use the second data allocation rule to update the target data allocation rule in the alternative data allocation rules. At the same time, since the data allocation rule corresponding to the target virtual network card has been updated, the software forwarding module can also control the hardware forwarding module to delete the flow table (i.e., the target flow table in the above embodiments) generated using the data allocation rule before the update and stored locally. And the software forwarding module can also regenerate the flow table according to the updated data allocation rule and further send the flow table to the hardware forwarding module. Optionally, the virtual instance can also use the monitoring tool or monitoring interface configured by itself to monitor the rule update operation.

[0089] In this embodiment, in response to the rule update operation, while the software forwarding module updates the locally stored data allocation rule, it can also control the hardware forwarding module to delete the flow table generated according to the data allocation rule before the update, so as to ensure that both the software forwarding module and the hardware forwarding module can use the same data allocation rule to implement packet forwarding.

[0090] As can be seen from the descriptions in the above embodiments, after the manager obtains the data allocation rule configured by the user, while synchronizing this data allocation rule to the software forwarding module in the virtual switch, the manager can also store the data allocation rule itself. And optionally, on the Figure 1a or Figure 2a basis of the physical host shown, the physical host can further include a storage space.

[0091] Then taking the Figure 1a physical host shown as an example, Figure 3 it is a schematic structural diagram of another physical host provided by the embodiment of the present application. As Figure 3 shown, the physical host can further include a storage space. The manager can also store the data allocation rule in the database, and the storage space required by the database can be provided by the physical host.

[0092] The data allocation rule is stored in the manager of the virtual instance, the software forwarding module in the virtual switch, and the database. Then optionally, when the virtual switch in the physical host is restored after a failure, in response to the restoration of the virtual switch after the failure, the manager can synchronize the data allocation rule stored by itself (such as the alternative data allocation rule mentioned in the above embodiments) to the software forwarding module in the virtual switch.

[0093] Optionally, after the virtual switch undergoes a hot upgrade, the manager can send the data allocation rules stored in itself to the software forwarding module in the virtual switch after the hot upgrade.

[0094] In this embodiment, when the virtual switch recovers from a failure or undergoes a hot migration, the manager can directly read the data allocation rules from the local and synchronize them to the virtual switch, thereby reducing the impact on packet forwarding when the virtual switch recovers from a failure or undergoes a hot migration.

[0095] Optionally, after the manager recovers from a failure, the manager can directly read the data allocation rules from the storage space provided by the physical host in response to its own recovery from the failure. Optionally, after the virtual instance manager undergoes a hot upgrade, the manager after the hot upgrade can read the alternative data allocation rules from the storage space provided by the physical host in response to its own startup.

[0096] In this embodiment, after the manager recovers from a failure or undergoes a hot upgrade, the manager can reread and store the data allocation rules from the database so that when the virtual switch recovers from a failure or undergoes a hot migration, the data allocation rules can be synchronized to the virtual switch in a timely manner to reduce the impact of the virtual switch's recovery from a failure or hot migration on packet forwarding.

[0097] Optionally, the physical host serving as the source host may include a source virtual instance, a source manager, and a source virtual switch, and when the source virtual instance migrates from the source physical host to the destination host to form a destination virtual instance, the source manager can send the data allocation rules stored in the source manager to the destination manager in the destination host in response to the hot migration of the source virtual instance. After the source virtual instance successfully migrates to the destination host, that is, after the memory copy and virtual instance configuration of the virtual instance are completed, the destination manager can further send the data allocation rules to the software forwarding module of the destination virtual switch in the destination host. In this embodiment, the data allocation rules are stored in the manager. Therefore, when the source virtual instance undergoes a hot migration from the source host to the destination host, the data allocation rules can also be migrated to the destination host together with the manager and finally be obtained by the software forwarding module in the destination virtual switch.

[0098] In summary, for the physical host provided in each of the above embodiments of the present application, on the one hand, the virtual switch can be provided with a software forwarding module for generating a flow table and a hardware forwarding module for querying the flow table at the same time. The two work together to save each other's computing resources, and at the same time, offloading the flow table query process to hardware execution can also improve the packet forwarding efficiency.

[0099] On the other hand, the data distribution rules can also be stored in the databases provided by both the manager and the physical host, so that there is no need for manual reconfiguration of the data distribution rules during the hot upgrade process of the manager and / or the virtual switch. And during the hot migration of virtual instances, the data distribution rules can also be hot migrated together, without the need for manual reconfiguration on the destination host.

[0100] The following describes the process of collaborative packet processing among the virtual switch, the manager, and the virtual instances in a physical host in a specific scenario. And the following process can also be combined with Figure 4 understanding.

[0101] Suppose the physical host provides N CPU cores. The virtual instances running on the physical host can be ECS servers, and the number of ECS servers is M. Each ECS server can include K virtual network cards, and each virtual network card is configured with P receive queues. The virtual switch running on the physical host can be a smart network card, and the hardware forwarding module in the hardware network card can be an FPGA. Users configure corresponding data distribution rules for different virtual network cards. And the data packets transmitted in the virtualized network composed of ECS servers can be the data packets generated during the use of cloud services.

[0102] When data packet 1 arrives at the FPGA of the virtual switch first, it can be queried in the flow table locally stored in the FPFA. If the data packet 1 does not hit the corresponding flow table, the software forwarding module can determine that the receive queue of the data packet 1 is queue P in virtual network card 1 in the manner of the above embodiments, and generate a flow table 1 for this data packet 1. This flow table can be synchronized to the FPFA. When data packet 2 arrives at the FPGA, if the data packet 2 hits flow table 1, the I / O module can directly use the identity identifiers of the virtual network card and the queue recorded in the flow table to put the data packet 2 into queue P in virtual network card 1. Finally, both data packet 1 and data packet 2 can be processed by CPU core 2 bound to queue P.

[0103] And when the ECS in the physical host undergoes hot migration, or after the virtual switch or the virtual machine manager fails and recovers or is hot upgraded, there is no need for manual reconfiguration of the data distribution rules.

[0104] In addition, the content not described in detail and the technical effects that can be achieved in this embodiment can be seen in the descriptions of the above embodiments, and will not be elaborated here.

[0105] Based on the physical host provided in the above embodiments, the specific structure and working process of the virtual switch in the physical host can be separately introduced below. Then Figure 5 is a schematic structural diagram of a virtual switch provided by an embodiment of the present application. As Figure 5As shown, the virtual switch may include: a hardware forwarding module, a software forwarding module, and an I / O module.

[0106] The working process of the virtual switch can be described as follows:

[0107] The hardware forwarding module in the virtual switch can receive a first data packet and query it in the locally stored flow table. If the five-tuple information of the first data packet is not included in the locally stored flow table, indicating that the first data packet is the first data packet in the data stream to be obtained by the hardware forwarding module, the hardware forwarding module can send the first data packet to the software forwarding module.

[0108] In response to the reception of the first data packet, the software forwarding module can determine the target virtual network card in the virtual instance according to the metadata of the first data packet, then determine the target data allocation rule corresponding to the target virtual network card in the alternative data allocation rules locally stored in the software forwarding module, and determine the target receiving queue in the multiple receiving queues configured for the target virtual network card according to the target data allocation rule. Finally, the I / O module in the virtual switch can put this first data packet into the target receiving queue configured for the target virtual network card in the virtual instance, so that the first data packet can be processed by the target processor core bound to the target receiving queue. Among them, there is a preset binding relationship between the receiving queue configured for the virtual network card in the virtual instance and the processing core configured in the physical host, and this binding relationship can be configured by the virtual instance manager during the process of creating the virtual instance.

[0109] Optionally, after determining the target receiving queue, the software forwarding module can further generate a target flow table including the identity identifier of the target virtual network card, the identity identifier of the target receiving queue, and the five-tuple information of the first data packet. Then when the hardware forwarding module receives a second data packet after the first data packet, if the target flow table contains the five-tuple information of the second data packet, indicating that the second data packet belongs to the same data stream as the first data packet, the hardware forwarding module can directly determine the target receiving queue according to the target flow table, and the I / O module can put the second data packet into the target receiving queue of the target virtual network card.

[0110] And for any data packet obtained by the virtual switch, using the data allocation rules in the software forwarding module or using the flow table in the hardware forwarding module can allocate the data packet to a certain receiving queue configured for a certain virtual network card in the virtual instance, that is, RSS is implemented in the virtual instance. In addition, the working process of the virtual switch in this embodiment can be combined with Figure 2b Understood.

[0111] In addition, for the manner of obtaining the alternative data distribution rules, the specific content included in the data distribution rules, and the specific manner of determining the target virtual network card, the target data distribution rule, and the target receive queue, reference may be made to the relevant descriptions in the above embodiments, which will not be elaborated herein.

[0112] In this embodiment, for the received data packet, it can be first queried in the flow table stored in the hardware forwarding module. If the metadata of the data packet does not hit the flow table, the software forwarding module can, according to the data distribution rules stored locally and the metadata of the data packet, allocate the data packet to the target receive queue configured for the virtual network card, so that the processor core bound to the target receive queue processes the data packet. At the same time, the software forwarding module can also generate a flow table for the data stream to which the data packet belongs, so that when the hardware forwarding module receives subsequent data packets of this data stream, it can directly forward the data packets by querying the flow table.

[0113] The hardware forwarding module in the virtual switch is used for flow table query, which can save the computing resources of the software forwarding module while also improving the query speed of the flow table. At the same time, the software forwarding module in the virtual switch can adopt the multi-queue reception method to allocate different data packets to different queues configured for the virtual network cards in the virtual instance, so that the processor cores respectively bound to different queues process them. Compared with implementing data packet forwarding using hardware, the software forwarding module can improve the configuration flexibility and convenience of the data distribution rules, making the allocation of data packets more reasonable. And compared with implementing data packet forwarding using hardware, after directly configuring the data distribution rules in the software forwarding module, when the virtual instance is hot migrated to a new physical host, the data distribution rules can also be directly hot migrated, thus omitting the process of reconfiguring the queue allocation rules on the new physical host.

[0114] In addition, for the content not described in detail in this embodiment and the beneficial effects that can be achieved, reference may be made to the relevant descriptions in the above embodiments, which will not be elaborated herein.

[0115] The above Figures 1a to 5 The above-described embodiments have described the process of processing data packets from the perspective of the internal structure of the device. Next, the working process of the software forwarding module in the virtual switch can be introduced from the perspective of the process.

[0116] Figure 6 is a flowchart of a data packet processing method provided by an embodiment of the present application. The method provided by the embodiment of the present application can be executed by the software forwarding module in the above device embodiments. As Figure 6 shown, the method may include the following steps:

[0117] S101, determine the target virtual network card in the virtual instance according to the metadata of the first data packet.

[0118] S102. Determine the target data distribution rule corresponding to the target virtual network card among the alternative data distribution rules stored in the software forwarding module.

[0119] S103. According to the target data distribution rule, determine the target receiving queue among the multiple queues configured for the target virtual network card, so that the target processor core bound to the target receiving queue processes the first data packet.

[0120] In response to the reception of the first data packet, the software forwarding module in the virtual switch can first determine the target virtual network card in the virtual instance according to the metadata of the first data packet, and then determine the target data distribution rule corresponding to the target virtual network card among the alternative data distribution rules locally stored in the software forwarding module, and according to the target data distribution rule, determine the target receiving queue among the multiple receiving queues configured for the target virtual network card. The first data packet can be placed by the I / O module in the virtual switch into the target receiving queue configured for the target virtual network card in the virtual instance, so that the target CPU core bound to the target receiving queue processes the first data packet.

[0121] For any data packet obtained by the virtual switch, the software forwarding module can distribute the data packet to a receiving queue configured for a certain virtual network card in the virtual instance according to the metadata of the data packet and the locally stored data distribution rule, that is, RSS is implemented in the virtual instance.

[0122] Optionally, the process of determining the queue using the data distribution rule can be referred to the description in the above related embodiments, and will not be elaborated here.

[0123] In this embodiment, after the virtual switch receives a data packet, the software forwarding module in the virtual switch can distribute the data packet to a queue configured for the virtual network card according to the locally stored data distribution rule and the metadata of the data packet, so that the processor core bound to the queue processes the data packet.

[0124] In the above process, the software forwarding module in the virtual switch can use the multi-queue reception method to distribute different data packets to different queues configured for the virtual network card in the virtual instance, so that the processor cores bound to the different queues process them respectively. Compared with implementing data packet forwarding using hardware, the software forwarding module can improve the configuration flexibility and convenience of the data distribution rule, making the distribution of data packets more reasonable. And compared with implementing data packet forwarding using hardware, after directly configuring the data distribution rule in the software forwarding module, when the virtual instance is hot migrated to a new physical host, the data distribution rule can also be directly hot migrated, thus omitting the process of reconfiguring the queue distribution rule on the new physical host.

[0125] In addition, for the content not described in detail in this embodiment and the beneficial effects that can be achieved, reference can be made to the relevant descriptions in the above embodiments, which will not be elaborated here.

[0126] Figure 7 It is a flowchart of another data packet processing method provided by an embodiment of this application. As Figure 7 shown, this method may include:

[0127] S201, Receive a first data packet sent by a hardware forwarding module in a virtual switch.

[0128] S202, Determine a target virtual network card in a virtual instance according to the metadata of the first data packet.

[0129] S203, In the alternative data distribution rules stored in the software forwarding module, determine a target data distribution rule corresponding to the target virtual network card.

[0130] S204, According to the target data distribution rule, determine a target receiving queue among multiple queues configured for the target virtual network card, so that a target processor core bound to the target receiving queue processes the first data packet.

[0131] S205, Generate a target flow table including the identifiers of the target virtual network card and the target receiving queue respectively, and the five-tuple information of the first data packet.

[0132] S206, Send the target flow table to the hardware forwarding module, so that the virtual switch puts a second data packet into the target receiving queue according to the target flow table. The second data packet and the first data packet belong to the same data stream, and the virtual switch receives the second data packet after the first data packet.

[0133] In this embodiment, the first data packet can be first obtained by the hardware forwarding module and forwarded to the software forwarding module when the flow table is not hit, so that the software forwarding module determines the target receiving queue for receiving the first data packet. At the same time, the software forwarding module can also generate and forward the target flow table to the hardware forwarding module, so that when the hardware forwarding module receives a second data packet belonging to the same data stream after the first data packet, it can directly query the flow table to determine the target receiving queue.

[0134] In addition, for the content not described in detail in this embodiment and the beneficial effects that can be achieved, reference can be made to the relevant descriptions in the above embodiments, which will not be elaborated here.

[0135] Optionally, the user can also trigger a rule update operation. After the virtual instance responds to the rule update operation, it can update the data distribution rules in the software forwarding module, the virtual instance manager, and the database. At the same time, it can also delete the flow tables generated using the updated data distribution rules.

[0136] In addition, for the content not described in detail in this embodiment and the beneficial effects that can be achieved, reference can be made to the relevant descriptions in the above embodiments, and details will not be elaborated here.

[0137] The following will describe in detail a data packet processing device according to one or more embodiments of the present application. Those skilled in the art can understand that the device can be configured by using commercially available hardware components through the steps taught by this solution.

[0138] Figure 8 It is a schematic structural diagram of a data packet processing device provided for an embodiment of the present application. As Figure 8 shown, the device can be used as a software forwarding module in a virtual switch. Among them, the virtual switch is communicatively connected to at least one virtual network card in the virtual instance. Any virtual network card in the virtual instance is configured with multiple receive queues. The virtual switch and the virtual instance are deployed in the same physical host, and the physical host includes multiple processor cores.

[0139] The device may include:

[0140] A network card determination module 11, configured to determine a target virtual network card in the virtual instance according to the metadata of the first data packet.

[0141] A rule determination module 12, configured to determine a target data distribution rule corresponding to the target virtual network card from the alternative data distribution rules stored in the software forwarding module.

[0142] A queue determination module 13, configured to determine a target receive queue from the multiple queues configured for the target virtual network card according to the target data distribution rule, so that the target processor core bound to the target receive queue processes the first data packet

[0143] Optionally, the metadata of the data packet includes five-tuple information, the target data distribution rule includes a preset operator, a preset hash algorithm, and an identification sequence, and the identification sequence includes queue identifiers of the multiple receive queues configured for the target virtual network card.

[0144] The queue determination module 13 is configured to input the four-tuple information in the five-tuple information of the first data packet and the preset operator into the preset hash algorithm;

[0145] Determine a target identifier in the identification sequence, where the number of the target identifier in the identification sequence is the same as the output result of the preset hash algorithm;

[0146] Determine the queue with the target identifier as the target receive queue.

[0147] Optionally, the target data distribution rule further includes a protocol type.

[0148] The apparatus further includes: a queue determination module 13, configured to input the quadruple information of the first data packet and the preset operator into the preset hash algorithm if the protocol type in the five-tuple information of the first data packet is the same as the protocol type in the target data distribution rule.

[0149] Optionally, the first data packet is sent from a hardware forwarding module in the virtual switch to the software forwarding module, and the metadata of the first data packet includes the five-tuple information of the first data packet.

[0150] The apparatus further includes a receiving module 14, a flow table generation module 15, and a sending module 16.

[0151] The receiving module 14 is configured to receive the first data packet sent by the hardware forwarding module.

[0152] The flow table generation module 15 is configured to generate a target flow table including identifiers of the target virtual network card and the target receiving queue, respectively, and the five-tuple information.

[0153] The sending module 16 is configured to send the target flow table to the hardware forwarding module, so that the hardware forwarding module sends a second data packet to the target receiving queue configured for the target virtual network card according to the target flow table. The second data packet belongs to the same data stream as the first data packet, and the hardware forwarding module receives the second data packet after receiving the first data packet.

[0154] Optionally, a manager of the virtual instance is further deployed in a physical host on which the virtual instance and the virtual switch are deployed.

[0155] The apparatus further includes a rule management module 17, configured to receive a second data distribution rule sent by the virtual instance manager, where the virtual instance sends the second data distribution rule to the virtual instance manager in response to a rule update operation for the target virtual network card;

[0156] Update the target data distribution rule in the alternative data distribution rule by using the second data distribution rule;

[0157] Control the hardware forwarding module to delete the target flow table stored in the hardware forwarding module;

[0158] Regenerate a flow table according to the to-be-updated data distribution rule.

[0159] Figure 8 The shown apparatus can execute Figure 6 andFigure 7 For the method of the embodiment shown in FIG. 1 , reference may be made to the description of the part not described in detail in this embodiment. Figure 6 and Figure 7 The implementation process and technical effects of this technical solution can be found in Figure 6 and Figure 7 The description in the illustrated embodiment will not be repeated here.

[0160] In one possible design, the packet processing methods provided in the above embodiments can be applied to an electronic device. The electronic device can function as a virtual switch, configured to transmit packets between virtual instances. The virtual instances can include at least one virtual network card (VNIC), each of which can be configured with multiple receive queues. The virtual switch and the virtual instances can be deployed on the same physical host, which includes multiple processor cores.

[0161] like Figure 9 As shown, the electronic device may include: a processor 21 and a memory 22. The memory 22 is used to store the network component to perform the above Figures 6 to 7 The program of the data packet processing method provided in the illustrated embodiment, the processor 21 is configured to execute the program stored in the memory 22 .

[0162] The program includes one or more computer instructions, wherein the one or more computer instructions, when executed by the processor 21, can implement the following steps:

[0163] Determine a target virtual network card in the virtual instance according to metadata of the first data packet;

[0164] Determining a target data allocation rule corresponding to the target virtual network card from among the candidate data allocation rules stored in the software forwarding module;

[0165] According to the target data allocation rule, a target receiving queue is determined from a plurality of queues configured in the target virtual network card, so that a target processor core associated with and bound to the target receiving queue processes the first data packet.

[0166] Optionally, the processor 21 is further configured to execute the aforementioned Figures 6 to 7 All or part of the steps in the illustrated embodiments.

[0167] The structure of the network component may further include other components such as a communication component 23, a display 24, a power component 25, and an audio component 26.

[0168] Figure 9 Only some components are shown schematically, which does not mean that the network components only include Figure 9 In addition,Figure 9 The components in are optional components, rather than mandatory components, and can be determined according to the product form of the specific visual network components. The electronic device in the embodiment of the present application can be a server device such as a conventional server, a cloud server or a server array.

[0169] The above-mentioned memory 22 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random-Access Memory, abbreviated as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read Only Memory, abbreviated as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, abbreviated as EPROM), programmable read-only memory (Programmable Read-Only Memory, abbreviated as PROM), read-only memory (Read-OnlyMemory, abbreviated as ROM), magnetic memory, flash memory, magnetic disk or optical disc.

[0170] The above-mentioned communication component 23 is configured to facilitate communication between the device where the communication component is located and other devices in a wired or wireless manner. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G / LTE, 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component further includes a near field communication (Near Field Communication, abbreviated as NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (Radio Frequency Identification, abbreviated as RFID) technology, infrared data association (Infrared Data Association, abbreviated as IrDA) technology, ultra-wideband (Ultra Wide Band, abbreviated as UWB) technology, Bluetooth (BlueTooth, abbreviated as BT) technology and other technologies.

[0171] The above-mentioned display 24 includes a screen, and the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can not only sense the boundaries of touch or swipe actions, but also detect the duration and pressure associated with the touch or swipe operations.

[0172] The above-mentioned power supply component 25 provides power for various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device where the power supply component is located.

[0173] The above-mentioned audio component 26 can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC). When the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive external audio signals. The received audio signals can be further stored in a memory or sent via a communication component. In some embodiments, the audio component further includes a speaker for outputting audio signals.

[0174] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it causes the processor to be able to implement the steps in the above method embodiments. Among them, the computer-readable storage medium can be implemented by a volatile or non-volatile or a combination thereof, and can be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, Phase-change Random Access Memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), flash memory or other memory technologies, Compact Disc Read Only Memory (CD-ROM), Digital Video Disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices or any other non-transmission medium

[0175] Correspondingly, the embodiments of the present application further provide a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the processor is enabled to implement each step in the above method embodiments. It should be understood that each process or the combination of multiple processes in the above method flow can be implemented by the computer program or instructions. In addition, these computer programs or instructions can be applied to the processors of general-purpose computers, special-purpose computers, embedded processors or other programmable data processing devices, so that the processors of general-purpose computers, special-purpose computers, embedded processors or other programmable data processing devices can be used as devices to implement the corresponding functions in the above method embodiments.

[0176] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data packet processing method, characterized in that: A physical host includes multiple processor cores, a virtual switch, a virtual instance, and a manager of the virtual instance are deployed in the physical host, the virtual instance includes at least one virtual network card, and each virtual network card is configured with multiple receive queues. The method is applied to a software forwarding module in the virtual switch; the method includes: receiving a first data packet sent by a hardware forwarding module in the virtual switch; Determining a target virtual network card in the virtual instance according to metadata of the first data packet, where the metadata of the first data packet includes quintuple information of the first data packet; Among the candidate data allocation rules stored in the software forwarding module, a target data allocation rule corresponding to the target virtual network card is determined. The candidate data allocation rules include data allocation rules corresponding to different virtual network cards. The candidate data allocation rules are sent to the manager after the virtual instance monitors a user-triggered rule configuration operation, and are then sent by the manager to the software forwarding module. The candidate data allocation rules are used by the manager to directly read from the local computer and synchronized to the virtual switch when the virtual switch recovers after a failure or hot migrates. The target data allocation rule is a user-defined data allocation rule including a preset operator, a preset hash algorithm, and an identification sequence, and the preset operator includes a bit string of indefinite length. determining, according to the target data allocation rule, a target receive queue from a plurality of receive queues configured for the target virtual network card, so that a target processor core associated with the target receive queue processes the first data packet; Generate a target flow table including the identifiers of the target virtual network card and the target receive queue, and the five-tuple information; When the virtual switch receives a second data packet after the first data packet, if the five-tuple information of the second data packet is included in the target flow table, the identifiers of the target virtual network card and the target receive queue are read from the target flow table, and the input / output module in the virtual switch puts the second data packet into the target receive queue configured for the target virtual network card; If the five-tuple information of the second data packet is not included in the target flow table, a receiving queue is determined for the second data packet, and a flow table of the data flow to which the second data packet belongs is generated.

2. The method according to claim 1, characterized in that The metadata of the data packet includes five-tuple information of the data packet, and the identification sequence includes queue identifications of the multiple receiving queues configured for the target virtual network card; Determining a target receiving queue from a plurality of queues configured on the target virtual network card according to the target data allocation rule includes: Inputting the quadruple information in the quintuple information of the first data packet and the preset operator into the preset hash algorithm; Determining a target identifier in the identifier sequence, wherein the number of the target identifier in the identifier sequence is the same as an output result of the preset hash algorithm; The queue having the target identifier is determined as the target receiving queue.

3. The method according to claim 2, characterized in that The target data allocation rule further includes a protocol type; and inputting the quadruple information in the quintuple information of the first data packet and the preset operator into the preset hash algorithm includes: If the protocol type in the five-tuple information of the first data packet is the same as the protocol type in the target data allocation rule, the four-tuple information of the first data packet and the preset operator are input into the preset hash algorithm.

4. The method according to claim 1, wherein The method further comprises: receiving a data allocation rule to be updated sent by the manager, wherein the data allocation rule to be updated is sent to the manager by the virtual instance in response to a rule update operation on the target virtual network card; Updating the target data allocation rule in the candidate data allocation rules by using the data allocation rule to be updated; Controlling the hardware forwarding module to delete the target flow table stored in the hardware forwarding module; The flow table is regenerated according to the data allocation rule to be updated.

5. A physical host, characterized in that: include: multiple processor cores, a manager, a virtual switch, and virtual instances running in an isolated environment provided by the physical host, at least one virtual network card in the virtual instance being configured with multiple receive queues, the virtual switch comprising a software forwarding module, an input / output module, and a hardware forwarding module; The virtual instance is configured to send, if monitoring a rule configuration operation for different virtual network cards in the virtual instance, an alternative data allocation rule corresponding to the rule configuration operation to the manager, wherein the alternative data allocation rule includes data allocation rules corresponding to different virtual network cards; the alternative data allocation rule is used by the manager to directly read from the local computer and synchronize to the virtual switch when the virtual switch recovers after a failure or hot migrates; The manager is configured to send the candidate data allocation rule to the software forwarding module; The software forwarding module is configured to receive a first data packet sent by the hardware forwarding module; In response to receiving a first data packet, determining a target virtual network card in the virtual instance according to metadata of the first data packet, wherein the metadata of the first data packet includes quintuple information of the first data packet; Among the candidate data allocation rules, determining a target data allocation rule corresponding to the target virtual network card, wherein the target data allocation rule is a user-defined data allocation rule including a preset operator, a preset hash algorithm, and an identification sequence, wherein the preset operator includes a bit string of indefinite length; Determining a target receiving queue from a plurality of receiving queues configured for the target virtual network card according to the target data allocation rule; An input / output module, configured to place the first data packet into the target receiving queue; a target processor core bound to the target receive queue, configured to read and process the first data packet from the target receive queue; The software forwarding module is also used to generate a target flow table including the respective identifiers of the target virtual network card and the target receiving queue, and the five-tuple information; when the virtual switch receives a second data packet after the first data packet, if the five-tuple information of the second data packet is contained in the target flow table, the respective identifiers of the target virtual network card and the target receiving queue are read from the target flow table, and the input and output module places the second data packet into the target receiving queue configured for the target virtual network card; if the five-tuple information of the second data packet is not contained in the target flow table, the receiving queue is determined for the second data packet, and a flow table for the data flow to which the second data packet belongs is generated.

6. The host according to claim 5, characterized in that The virtual instance is configured to send a second data allocation rule corresponding to a rule update operation to the manager if a rule update operation for the target virtual network card is monitored; The manager is configured to forward the second data allocation rule to the software forwarding module; The software forwarding module is configured to update the target data allocation rule in the candidate data allocation rule by using the second data allocation rule; and control the hardware forwarding module to delete the target flow table stored in the hardware forwarding module.

7. The host according to claim 5, characterized in that The metadata of the data packet includes four-tuple information, the target data allocation rule includes a preset operator, a preset hash algorithm and an identification sequence, and the identification sequence includes the queue identification of each of the multiple receiving queues configured by the target virtual network card; The software forwarding module is configured to input the quadruple information of the first data packet and the preset operator into the preset hash algorithm; Determining a target identifier in the identifier sequence, wherein the number of the target identifier in the identifier sequence is the same as an output result of the preset hash algorithm; The queue having the target identifier is determined as the target receiving queue.

8. The host according to claim 5, characterized in that: The target data allocation rule also includes a preset protocol type; The software forwarding module is configured to input the quadruple information of the first data packet and the preset operator into the preset hash algorithm if the protocol type in the five-tuple information of the first data packet is the same as the preset protocol type.

9. The host according to claim 5, characterized in that the manager, configured to send the candidate data allocation rule stored in the manager to a software forwarding module of the virtual switch in response to post-failure recovery of the virtual switch; or, In response to the hot upgrade of the virtual switch, the candidate data allocation rule stored in the manager is sent to the software forwarding module of the hot-upgraded virtual switch.

10. The host according to claim 5, characterized in that The physical host further comprises: a storage space storing the candidate data allocation rule; after the manager is hot-upgraded, the physical host comprises a destination manager; The destination manager is configured to read the candidate data allocation rule from the storage space in response to activation of the destination manager.

11. The host according to claim 5, characterized in that: The physical host further includes: a storage space storing the candidate data allocation rule; The manager is configured to read the candidate data allocation rule from the storage space in response to recovery after a failure of the manager.

12. The host according to claim 5, characterized in that The physical host is a source host; the source host includes a source virtual instance, a source manager, and a source virtual switch; the source virtual instance is migrated from the source host to a destination host; the destination host includes a destination virtual instance, a destination manager, and a destination virtual switch; The source manager is configured to send the alternative data allocation rule stored in the source manager to the destination manager in response to the hot migration of the source virtual instance, so that after the source virtual instance is migrated to the destination host, the destination manager sends the alternative data allocation rule to the software forwarding module of the destination virtual switch.

13. A virtual switch, characterized in that: include: Software forwarding module, hardware forwarding module and input and output module; The hardware forwarding module is configured to receive a first data packet; If the flow table stored in the hardware forwarding module does not contain metadata of the first data packet, sending the first data packet to the software forwarding module, where the metadata of the first data packet includes five-tuple information of the first data packet; The software forwarding module is configured to store candidate data allocation rules; determine a target data allocation rule corresponding to a target virtual network card among the candidate data allocation rules; and determine a target virtual network card in a virtual instance according to metadata of the first data packet in response to receiving the first data packet; According to the target data allocation rule, a target receiving queue is determined from multiple receiving queues configured for the target virtual network card; the alternative data allocation rule includes data allocation rules corresponding to different virtual network cards, the alternative data allocation rule is sent to the manager by the virtual instance after monitoring the user-triggered rule configuration operation and is forwarded by the software forwarding module of the manager, and the alternative data allocation rule is used by the manager to directly read from the local computer and synchronized to the virtual switch when the virtual switch recovers after a failure or hot migrates; the target data allocation rule is a user-defined data allocation rule including a preset operator, a preset hash algorithm, and an identification sequence, and the preset operator includes a bit string of indefinite length; The input / output module is configured to place the first data packet into the target receiving queue; The software forwarding module is also used to generate a target flow table including the respective identifiers of the target virtual network card and the target receiving queue, and the five-tuple information; when the virtual switch receives a second data packet after the first data packet, if the five-tuple information of the second data packet is contained in the target flow table, the respective identifiers of the target virtual network card and the target receiving queue are read from the target flow table, and the input and output module places the second data packet into the target receiving queue configured for the target virtual network card; if the five-tuple information of the second data packet is not contained in the target flow table, the receiving queue is determined for the second data packet, and a flow table for the data flow to which the second data packet belongs is generated.

14. A non-transitory machine-readable storage medium, characterized in that The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the data packet processing method according to any one of claims 1 to 4.

15. A computer program product, characterized in that The computer program product includes a computer program or instructions, so that when the computer program or instructions are executed by a processor, the steps in the data packet processing method according to any one of claims 1 to 4 can be implemented.

Citation Information

Patent Citations

  • Virtualization security network element data processing method and system, medium and cloud platform

    CN112437023A

  • Message forwarding order preserving method and device in DPU, electronic equipment and storage medium

    CN117560433A