Data packet processing method, physical host, virtual switch, medium and product

By applying multi-queue reception in the software forwarding module of the virtual switch, the packets are reasonably allocated to the receiving queue according to the metadata of the data packets, which solves the problem of unreasonable packet allocation in the core equipment of the multi-processor, improves packet processing efficiency and supports hot migration of virtual instances.

CN119676199AActive Publication Date: 2025-03-21ALIBABA CLOUD COMPUTING CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

In multiprocessor core devices, how to reasonably allocate packets to different receive queues to improve packet processing efficiency, especially in receiver scaling mode.

Method used

By applying multi-queue reception in the software forwarding module of the virtual switch, the target virtual network card is determined based on the metadata of the data packet, and the target data allocation rules are determined in the stored alternative data allocation rules to determine the target reception queue, so that the processor core bound to the queue can process the data packet.

Benefits of technology

Improves packet processing efficiency, improves the situation of excessive load on a single processor core, and makes packet allocation more reasonable, supporting hot migration of virtual instances without reconfiguring queue allocation rules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119676199A_ABST
    Figure CN119676199A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data packet processing method, a physical host, a virtual switch, a medium and a product, when a data packet is acquired by the virtual switch, a software forwarding module in the virtual switch can forward the data packet according to a locally stored data distribution rule and metadata of the data packet; and distributing the data packet to a target receiving queue configured by a virtual network card in the virtual instance, and processing the data packet by a processor core bound with the target receiving queue, namely realizing multi-queue receiving of the data packet. In the process, the process of distributing the data packets by using the data distribution rule is realized by the software module. Compared with configuration of data distribution rules in a hardware module, richer data distribution rules can be configured in a software module, so that distribution of data packets is more reasonable. And when the virtual host is subjected to thermal migration, the data distribution rule configured in the software module can be directly subjected to thermal migration, so that the process of reconfiguring the data distribution rule on a new physical host is omitted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present 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] During network communication, for devices equipped with multiple processor cores (usually CPU cores), when in Receive Side Scaling (RSS) mode, the received data packets can be dispersed 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 packet processing is implemented by multi-queue reception. While improving the data packet processing efficiency, it can also improve the situation where the single processor core is overloaded.

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

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

[0005] The embodiment of the present application provides a data packet processing method, wherein a physical host includes multiple processor cores, a virtual switch and a virtual machine 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 receiving queues. The method is applied to a software forwarding module in the virtual switch, and the method includes: Determine a target virtual network card in the virtual instance according to metadata of the first data packet; Determine, among the candidate data allocation rules stored in the software forwarding module, a target data allocation rule corresponding to the target virtual network card; 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 bound to the target receiving queue processes the first data packet.

[0006] The embodiment of the present 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 receiving queues, and the virtual switch includes a software forwarding module and an input and output module; The virtual instance is used to send the candidate data allocation 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; The manager is used to send the candidate data allocation rule to the software forwarding module; 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 metadata of the first data packet; determine a target data allocation rule corresponding to the target virtual network card among the candidate data allocation rules; and determine a target receiving queue among multiple 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; The target processor core bound to the target receiving queue is used to read and process the first data packet from the target queue.

[0007] The embodiment of the present application provides a virtual switch, including: a software forwarding module, a hardware forwarding module and an 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, the first data packet is sent to the software forwarding module; The software forwarding module is used to store candidate data allocation rules; determine a target data allocation rule corresponding to the target virtual network card among the candidate data allocation rules; 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; determine a target receiving queue among multiple receiving queues configured for the target virtual network card according to the target data allocation rule; The input-output module is used to put the first data packet into the target receiving queue.

[0008] The embodiment of the present application provides a data packet processing device, which may be a software forwarding module in a virtual switch, wherein the virtual instance includes at least one virtual network card, and any virtual network card is configured with multiple receiving queues, and the virtual switch and the virtual instance are deployed in the same physical host, and the physical host includes multiple processor cores; The device comprises: A network card determination module, configured to determine a target virtual network card in the virtual instance according to metadata of the first data packet; A rule determination module, configured to determine 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; The queue determination module is used to determine a target receiving queue from multiple queues configured in the target virtual network card according to the target data allocation rule, so that the target processor core associated with the target receiving queue processes the first data packet.

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

[0010] An embodiment of the present application provides a non-transitory machine-readable storage medium having executable code stored thereon. 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.

[0011] An embodiment of the present application provides 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 the data packet processing method as described above.

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

[0013] In the above process, the software forwarding module in the virtual switch can allocate different data packets to different queues configured by the virtual network card in the virtual instance by using a multi-queue receiving method, so that they can be processed by the processor cores 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 allocation rules, making the allocation of data packets more reasonable. And compared with using hardware to implement data packet forwarding, after the data allocation rules are directly configured in the software forwarding module, when the virtual instance is hot migrated to a new physical host, the data allocation rules can also be directly hot migrated, thereby eliminating the process of reconfiguring queue allocation rules on the new physical host. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] 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 of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1a A schematic diagram of the structure of a physical host provided in an embodiment of the present application; Figure 1b for Figure 1a Schematic diagram of the working process of the physical host shown; Figure 2a A schematic diagram of the structure of another physical host provided in an embodiment of the present application; Figure 2b for Figure 2a Schematic diagram of the working process of the physical host shown; Figure 3 A schematic diagram of the structure of another physical host provided in an embodiment of the present application; Figure 4 A schematic diagram of a data packet processing process in a cloud service scenario provided by an embodiment of the present application; Figure 5 A schematic diagram of the structure of a virtual switch provided in an embodiment of the present application; Figure 6 A flowchart of a data packet processing method provided in an embodiment of the present application; Figure 7 A flowchart of another data packet processing method provided in an embodiment of the present application; Figure 8 A schematic diagram of the structure of a data packet processing device provided in an embodiment of the present application; Fig. 9 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0016] 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", "said", and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the inclusion of at least one.

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

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

[0019] 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 used 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, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

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

[0021] Some embodiments of the present application may be described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments may be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0022] In order to facilitate the understanding of the solution, the following describes the data packet processing process in combination with the internal structure of the physical host. Figure 1a~Figure 3 A detailed description of the illustrated embodiments.

[0023] Figure 1a A schematic diagram of the structure of a physical host provided in an embodiment of the present application. Figure 1b for Figure 1a The process of a physical host processing a data packet is shown in FIG. The physical host is configured with multiple processor cores, and a virtual switch (Virtual Switch, referred to as vSwitch), a virtual instance, and a manager of the virtual instance may also be run in the physical host, and the manager is referred to as the manager in the subsequent embodiments. Optionally, multiple processor cores may be configured on the same physical host, and at least one virtual instance and at least one virtual switch may also be deployed. Figure 1a As shown, a physical host can be configured with N processor cores and M virtual instances, but there is no size relationship between M and N. Virtual instances and virtual switches running in the same or different physical hosts can be included in a virtualized network. Virtual switches can transmit data packets between different virtual instances, and virtual instances can receive and process data packets sent by virtual switches, thereby realizing network communication in a virtualized network.

[0024] Optionally, the virtual instance may specifically include a virtual machine (Virtual Machine, VM for short) or a container.

[0025] 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 may include at least one virtual network card, and at least one virtual network card may be configured with multiple receive queues. The virtual switch may include a forwarding module for determining a 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, so it can also be called a software forwarding module, and the software forwarding module may include an instruction set for execution by the CPU to implement data packet forwarding. The I / O module can be implemented in hardware or software.

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

[0027] When the virtual instance is a virtual machine, the manager of the virtual instance may specifically be a virtual machine manager (Virtual Machine Manager, VMM for short). Optionally, the manager may specifically include a kernel-based virtual machine (KVM for short) or a quick emulator (QEMU for short). Among them, the manager is optional. When the virtual instance is specifically a virtual machine, the manager and the virtual machine may communicate with each other by means of a high-speed communication path provided by the Peripheral Component Interconnect Express (PCIe) technology, such as transmission data allocation rules. The manager and the software forwarding module in the virtual switch may communicate through shared memory, socket communication, or semaphore.

[0028] When the virtual instance is a container, the manager specifies the container runtime.

[0029] Optionally, data packets transmitted between different virtual instances can form a data stream. The data stream can be generated by users in the process of using the services provided by the service provider. The service provider can provide services in the form of applications or cloud services. And the data packets generated by using different services can belong to different data streams. And the content in the data packet is different depending on the service content. For example, when the service is a cloud game, the data packet may include game data; when the service is a cloud computing service, the data packet may 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 that do not require high processing timeliness can be called batch data streams, such as data streams used for model training in the cloud.

[0030] Based on the above introduction to the various parts of the physical host, the process of processing data packets by the virtual instance in the physical host can be described as follows: In response to receiving the first data packet, the software forwarding module in the virtual switch can first determine the target virtual network card in the virtual instance based on the metadata of the first data packet, and then determine the target data allocation rule corresponding to the target virtual network card from the alternative data allocation rules stored locally in the software forwarding module, and determine the target receiving queue from the multiple receiving queues configured for the target virtual network card based on the target data allocation rule. Finally, the I / O module in the virtual switch can put the 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. Figure 1bAs shown, the target virtual network card may be virtual network card 1, the target receiving queue may be queue P, and the target processor core may be processor core 2.

[0031] The metadata of the first data packet may include five-tuple information of the first data packet. The five-tuple information may specifically include a source Internet Protocol (IP) address, a destination IP address, a source port number, a destination port number, and a protocol type. The five-tuple may include four-tuple information, namely, a source IP address, a destination IP address, a source port number, and a destination port number. There is a preset binding relationship between the receiving queue configured by the virtual network card in the virtual instance and the multiple processor cores in the physical host, and the binding relationship can be configured by the virtual instance manager during the process of creating the virtual instance.

[0032] Among them, considering that data packets belonging to different types of data flows can be allocated to receiving queues configured by different virtual network cards in the virtual instance, therefore, optionally, for the data allocation rules corresponding to different virtual network cards contained in the alternative data allocation rules, the software forwarding module needs to find the corresponding virtual network card and the data allocation rule of the network card from the alternative data allocation rules based on the metadata in the data packet that can reflect the type of data flow to which the data packet belongs.

[0033] In addition, the candidate data allocation rule stored locally in the software forwarding module may be acquired before receiving the first data packet, and the acquisition process of the candidate data allocation rule may be: The virtual instance can use the monitoring tool or monitoring interface deployed by itself to monitor whether to store the rule configuration operation triggered by the user. After monitoring the rule configuration operation, the alternative data allocation rule corresponding to the rule configuration operation can be sent to the manager. The manager itself can store the alternative data allocation rule, and 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 the alternative data allocation rule.

[0034] Optionally, the monitoring tool may be ethtool, and the monitoring interface may be an API interface included in a network packet processing library. The network packet processing library may be a data plane development kit (DPDK), and the monitoring interface may be an rte_flow interface in the DPDK. Optionally, both the manager and the virtual switch may run in a physical host as processes, so the alternative data allocation rule may be transmitted from the virtual instance manager to the virtual switch by means of inter-process communication. Optionally, the manager may also store the alternative data allocation rule. Optionally, the rule configuration operation may be an operation triggered by a user for different virtual instances in different physical hosts.

[0035] For any data packet acquired 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.

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

[0037] Optionally, after the virtual network card puts 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). If the virtual network card supports message signaled interrupts (MSI), it can send interrupts directly to the bound processor core. After the processor core receives the interrupt, it triggers a soft interrupt handler. The soft interrupt handler can then obtain the data packet from the receive queue and further process the data packet.

[0038] In the above process, the software forwarding module in the virtual switch can allocate different data packets to different queues configured by the virtual network card in the virtual instance by using a multi-queue receiving method, so that they can be processed by the processor cores 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 allocation rules, making the allocation of data packets more reasonable. And compared with using hardware to implement data packet forwarding, after the data allocation rules are directly configured in the software forwarding module, when the virtual instance is hot migrated to a new physical host, the data allocation rules can also be directly hot migrated, thereby eliminating the process of reconfiguring queue allocation rules on the new physical host.

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

[0040] Undertake Figure 1a In the description of the embodiment shown, after the virtual switch obtains the first data packet, it can first query the locally stored flow table. If the locally stored flow table does not contain the five-tuple information in the metadata of the first data packet, indicating that the first data packet is the first data packet obtained by the virtual switch in a data flow, the software forwarding module in the virtual switch can continue to query according to Figure 1a The method in the illustrated embodiment sequentially determines the target virtual network card and the target receiving queue, and finally processes the first data packet due to the target processor core bound to the target receiving 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 of the target virtual network card, and the identity of the target receiving queue.

[0041] After the target flow table is generated, when the virtual switch receives a second data packet after the first data packet, the software forwarding module can directly query the target flow table. If the five-tuple information of the second data packet is contained in the target flow table, indicating that the second data packet and the first data packet belong to the same data flow, the software forwarding module can directly read the identity identifiers of the target virtual network card and the target receiving queue from the target flow table, and the I / O module can put the second data packet into the target receiving queue configured by the target virtual network card. If the five-tuple information of the second data packet is not contained in the target flow table, indicating that the second data packet and the first data packet do not belong to the same data flow, the software forwarding module can continue to follow Figure 1a The illustrated method determines a receiving queue for the second data packet and generates a flow table for the data flow to which the second data packet belongs. Optionally, the target flow table may also include quadruple information of the data packet.

[0042] based on Figure 1a In the physical host shown in the figure, in this embodiment, for the data packet that first arrives at the virtual switch in the data flow, the software forwarding module can first determine the virtual network card and the receiving queue for it, and then the I / O module forwards the data packet to be processed by the corresponding processor core. For the data packet that subsequently arrives at the virtual switch in the same data flow, the software forwarding module can directly query the flow table to realize the forwarding of the data packet, thereby improving the forwarding speed of the data packet.

[0043] Based on the above embodiments, optionally, the forwarding speed of the data packet may be increased by hardware acceleration. Figure 2a A schematic diagram of the structure of another physical host provided in an embodiment of the present application. Figure 2b for Figure 2a The process of processing data packets by the physical host is shown in Figure 1. Figure 1a Based on the embodiment shown, the virtual switch in the physical host may further include a hardware forwarding module. The hardware forwarding module may store flow tables for different data flows generated by the software forwarding module, that is, the flow table query process is offloaded to the hardware for execution.

[0044] Data packets transmitted in the virtualized network can be preferentially obtained by the hardware forwarding module in the virtual switch. Figure 2a The process of processing data packets by the virtual instance in the physical host of the structure shown can be described as follows: The hardware forwarding module in the virtual switch can obtain the first data packet, and then 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 queried in the local flow table, indicating that the first data packet is the first data packet obtained by the virtual switch in the data flow to which the first data packet belongs, 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 turn, so that 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, as well as the metadata of the first data packet, and further forward the target flow table to the hardware forwarding module.

[0045] After the first data packet, the hardware forwarding module in the virtual switch may also receive a second data packet. If the hardware forwarding module queries the target flow table in the locally stored flow table, indicating that the second data packet and the first data packet belong to the same data flow, the I / O module may directly forward the second data packet to the target receiving queue according to the target flow table queried by the hardware forwarding module.

[0046] 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 may realize data transmission with the virtual instance and the software forwarding module respectively by means of a high-speed communication path provided by PCIe technology.

[0047] based on Figure 2aIn the physical host shown, in this embodiment, for a virtual switch that includes both a software forwarding module and a hardware forwarding module, a data packet can be first acquired by the hardware forwarding module, so that the hardware forwarding module first queries in the flow table. If the metadata of the data packet is not found in the flow table, it is necessary to use 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 flow table stored in the hardware forwarding module and the I / O module can be directly used to complete the data packet forwarding. 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.

[0048] In the physical host shown in the above embodiments, when the virtual instance processes the data packet, the software forwarding module has a process of determining the target virtual network card according to the metadata. For the determination of the target virtual network card, an optional way is that the software forwarding module can also store a routing forwarding table locally, and the IP address and the identity of the virtual network card can be recorded in the routing forwarding table. After receiving the first data packet, the software forwarding module can 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 way, the software forwarding module can store the correspondence between the data flow type and the virtual network card. Then, after receiving the first data packet, the software forwarding module can first determine the type of 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 between the data flow type and the virtual network card.

[0049] In the physical host shown in the above embodiments, when the virtual instance processes the data packet, the software forwarding module also has a process of determining the target data allocation rule. For the determination of the target data allocation rule, the software forwarding module can optionally store the data allocation rules configured by the user for different virtual network cards in the virtual instance, thereby forming the alternative data allocation rules mentioned in the above embodiments. After determining the target virtual network card, the software forwarding module can also find the target data allocation rule corresponding to the target virtual network card from the alternative data allocation rules.

[0050] In the physical host shown in the above embodiments, when the virtual instance processes the data packet, the software forwarding module also has a process of determining the target receiving queue according to the target data allocation rule. In order to facilitate understanding of how to determine the target receiving queue, the data allocation rule used in the process of determining the target receiving queue can be introduced below.

[0051] The user can configure different data allocation rules for different virtual network cards. Optionally, the data allocation rules of any virtual network card may include items such as preset operators, preset hash algorithms, and identification sequences. Optionally, the preset hash algorithm may be any of the common hash algorithms such as a hash algorithm based on a Toeplitz matrix or a hash algorithm based on an XOR operation, a hash algorithm based on polynomial division such as Cyclic Redundancy Check 32, etc. Optionally, the preset operator may be any of the 01-bit strings of indefinite length such as 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 receiving queues configured by any virtual network card can be arranged and numbered in sequence according to the arrangement order, and the identifier sequence can be obtained after sorting according to the size of the numbers. Optionally, the identifier sequence can be stored in an indirection table.

[0052] For example, any virtual network card can be configured with three receive queues with queue IDs 0, 1, and 2 respectively. The receive queue with queue ID 0 can be numbered 0, 1, and 2; the receive queue with queue ID 1 can be numbered 3, 4, and 5; the receive queue with queue ID 2 can be numbered 6, 7, and 8. The final identification sequence is [0, 0, 0, 1, 1, 1, 2, 2, 2].

[0053] It can be seen that the identification sequence can reflect the arrangement order, occurrence frequency and other information of the queue identification, and the occurrence frequency of different queue identifications in the identification sequence can also reflect the weight of the queue.

[0054] For example, any virtual network card can be configured with three receive queues with queue IDs 0, 1, and 2 respectively. The queue IDs of these three receive queues can be arranged in the indirect table as [0,0,0,1,1,1,2,2,2], [0,1,2,0,1,2,0,1,2], or [0,0,0,0,1,1,1,1,2], etc. In the last arrangement, the queue with queue ID 2 has a lower weight than the queue with queue ID 0 or 1.

[0055] Based on the above introduction to the data allocation rules, the process of determining the target receiving queue can be described below: After the software forwarding module receives the first data packet, the software forwarding module can first input the four-tuple information in the metadata of the first data packet and the preset operator in the target data allocation 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 also determine the identifier in the identifier sequence that is equal to the algorithm output result as the target identifier, and the queue with this target identifier is also the target receiving queue. Continuing with the above example, the identifier sequence is [0,0,0,1,1,1,2,2,2], and the queue identifiers in the identifier sequence are numbered 0~8 respectively. When the algorithm output result is 5, the queue with queue identifier 1 in the sequence can be determined as the target receiving queue.

[0056] Optionally, the data allocation rule may further include a preset protocol type based on the preset operator, the preset hash algorithm and the identification sequence. Specifically, after receiving the first data packet and determining the target data allocation rule, the software forwarding module may 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 allocation rule. If the protocol type in the five-tuple information is the same as the preset protocol type in the target data allocation rule, the software forwarding module may further determine the target receiving queue using other items in the target data allocation rule. Among them, the specific determination process of the target receiving queue is the same as that in the above embodiment, which will not be repeated here.

[0057] In this embodiment, the software forwarding module may determine a receiving queue for receiving data packets from a plurality of receiving queues configured in the virtual network card according to different items in the data allocation rule.

[0058] According to the descriptions in the above embodiments, data allocation rules are important parameters for implementing RSS, and as the characteristics of data packets change and the types of data streams become richer, users can optionally update the data allocation rules set for different virtual network cards. The characteristics of data packets may include the generation speed, generation frequency, and size of data packets.

[0059] 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 second data allocation rule corresponding to this rule update operation 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 rule. 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 locally stored flow table generated by the data allocation rule before the update (i.e., the target flow table in the above embodiments). And the software forwarding module can also regenerate the flow table according to the updated data allocation rule to further send the flow table to the hardware forwarding module. Optionally, the virtual instance can also use its own configured monitoring tool or monitoring interface to monitor the rule update operation.

[0060] In this embodiment, in response to the rule update operation, the software forwarding module can not only update the locally stored data allocation rules, but also control the hardware forwarding module to delete the flow table generated according to the data allocation rules before the update, thereby ensuring that both the software forwarding module and the hardware forwarding module can use the same data allocation rules to implement data packet forwarding.

[0061] Based on the descriptions in the above embodiments, it can be seen that after the manager obtains the data allocation rule configured by the user, the manager can synchronize the data allocation rule to the software forwarding module in the virtual switch and store the data allocation rule itself. Figure 1a or Figure 2a Based on the physical host shown, the physical host may further include storage space.

[0062] Then Figure 1a Take the physical host shown as an example. Figure 3 A schematic diagram of the structure of another physical host provided in the embodiment of the present application. Figure 3 As shown, the physical host may further include storage space. The manager may further store the data allocation rule in a database, and the storage space required for the database may be provided by the physical host.

[0063] The data allocation rules are stored in the manager of the virtual instance, the software forwarding module in the virtual switch, and the database. Optionally, when the virtual switch in the physical host recovers after a failure, the manager can synchronize its own stored data allocation rules (such as the alternative data allocation rules mentioned in the above embodiments) to the software forwarding module in the virtual switch in response to the recovery of the virtual switch.

[0064] Optionally, when the virtual switch is hot-upgraded, the manager may send the data allocation rule stored in the manager to the software forwarding module in the hot-upgraded virtual switch.

[0065] In this embodiment, when the virtual switch recovers or hot migrates after a failure, the manager can directly read the data allocation rule locally and synchronize it to the virtual switch, thereby reducing the impact of the virtual switch recovery or hot migration on data packet forwarding.

[0066] Optionally, when the manager recovers after 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 failure recovery. Optionally, when the virtual instance manager is hot-upgraded, the hot-upgraded manager can read the alternative data allocation rules from the storage space provided by the physical host in response to its own startup.

[0067] In this embodiment, when the manager recovers after a failure or a hot upgrade occurs, the manager can re-read and store the data allocation rules from the database so that when the virtual switch recovers after a failure or hot migrates, the data allocation rules can be synchronized to the virtual switch in time to reduce the impact of the virtual switch's recovery or hot migration after a failure on data packet forwarding.

[0068] 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 can be migrated from the source physical host to the destination host to form a destination virtual instance, the source manager can respond to the hot migration of the source virtual instance and send the data allocation rules stored in the source manager to the destination manager in the destination host. After the source virtual instance is successfully migrated 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, so when the source virtual instance is hot migrated from the source host to the destination host, the data allocation rules can also be migrated to the destination host with the help of the manager, and finally acquired by the software forwarding module in the destination virtual switch.

[0069] To summarize, for the physical host provided in the above embodiments of the present application, on the one hand, a software forwarding module for generating a flow table and a hardware forwarding module for querying a flow table can be simultaneously provided in the virtual switch. The collaborative work of the two can save each other's computing resources. At the same time, offloading the flow table query process to hardware execution can also improve the forwarding efficiency of data packets.

[0070] On the other hand, the data allocation rules can also be stored in the database provided by the manager and the physical host at the same time, so that there is no need to manually reconfigure the data allocation rules during the hot upgrade of the manager and / or the virtual switch. In addition, during the hot migration of the virtual instance, the data allocation rules can also be hot migrated, and there is no need to manually reconfigure them on the destination host.

[0071] The following is a specific scenario to describe the process of collaborative processing of data packets between the virtual switch, manager, and virtual instance in the physical host. Figure 4 understand.

[0072] Assume that the physical host provides N CPU cores. The virtual instance running on the physical host can be an ECS server, the number of ECS servers is M, and one ECS server can include K virtual network cards, each of which 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. The user configures corresponding data allocation rules for different virtual network cards. And the data packets transmitted in the virtualized network composed of ECS servers can be data packets generated during the use of cloud services.

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

[0074] Furthermore, when the ECS in the physical host undergoes hot migration, or when the virtual switch or virtual machine manager recovers or hot upgrades after a failure, there is no need to manually reconfigure the data allocation rules.

[0075] In addition, the contents not described in detail in this embodiment and the technical effects that can be achieved can be found in the descriptions of the above embodiments and will not be repeated here.

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

[0077] The working process of the virtual switch can be described as: The hardware forwarding module in the virtual switch can receive the 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, it indicates that the first data packet is the first data packet obtained by the hardware forwarding module in the data flow to which the data packet belongs, and the hardware forwarding module can send the first data packet to the software forwarding module.

[0078] In response to receiving 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, and then determine the target data allocation rule corresponding to the target virtual network card in the alternative data allocation rules stored locally 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 the first data packet into the target receiving queue configured by 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. There is a preset binding relationship between the receiving queue configured by the virtual network card in the virtual instance and the processing core configured in the physical host, and the binding relationship can be configured by the virtual instance manager during the process of creating the virtual instance.

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

[0080] And for any data packet obtained by the virtual switch, the data packet can be assigned to a receiving queue configured by a virtual network card in the virtual instance by using the data allocation rule in the software forwarding module or the flow table in the hardware forwarding module, 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 understand.

[0081] In addition, the method for obtaining the alternative data allocation rules, the specific content included in the data allocation rules, and the specific method for determining the target virtual network card, the target data allocation rules and the target receiving queue can all be referred to the relevant descriptions in the above embodiments and will not be repeated here.

[0082] In this embodiment, for the received data packet, a query can be first performed 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 allocate the data packet to the target receiving queue configured by the virtual network card according to the locally stored data allocation rules and the metadata of the data packet, so that the processor core bound to the target receiving queue can process the data packet. At the same time, the software forwarding module can also generate a flow table for the data flow to which the data packet belongs, so that when the hardware forwarding module receives subsequent data packets of this data flow, it can directly forward the data packet by querying the flow table.

[0083] The hardware forwarding module in the virtual switch is used to query the flow table, which can save the computing resources of the software forwarding module and improve the query speed of the flow table. At the same time, the software forwarding module in the virtual switch can allocate different data packets to different queues configured by the virtual network card in the virtual instance by using a multi-queue reception method, so that they can be processed by the processor cores bound to different queues. Compared with the use of hardware to implement data packet forwarding, the software forwarding module can improve the configuration flexibility and convenience of data allocation rules, making the allocation of data packets more reasonable. And compared with the use of hardware to implement data packet forwarding, after the data allocation rules are directly configured in the software forwarding module, when the virtual instance is hot migrated to a new physical host, the data allocation rules can also be directly hot migrated, thereby eliminating the process of reconfiguring queue allocation rules on the new physical host.

[0084] In addition, for other contents not described in detail in this embodiment and the beneficial effects that can be achieved, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.

[0085] Above Figure 1a~Figure 5 The illustrated embodiment has described the data packet processing process from the perspective of the internal structure of the device. The working process of the software forwarding module in the virtual switch can also be introduced from the perspective of the process.

[0086] Figure 6 Flow chart of a data packet processing method provided in an embodiment of the present application. The method provided in an embodiment of the present application can be executed by the software forwarding module in each of the above-mentioned device embodiments. Figure 6 As shown, the method may include the following steps: S101: Determine a target virtual network card in a virtual instance according to metadata of a first data packet.

[0087] S102: Determine a target data allocation rule corresponding to a target virtual network card from candidate data allocation rules stored in a software forwarding module.

[0088] S103, according to the target data allocation rule, determining a target receiving queue from multiple queues configured in the target virtual network card, so that the target processor core bound to the target receiving queue processes the first data packet.

[0089] In response to receiving 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 candidate data allocation rules stored locally 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. The first data packet can be placed in the target receiving queue configured for the target virtual network card in the virtual instance by the I / O module in the virtual switch, so that the first data packet can be processed by the target CPU core bound to the target receiving queue.

[0090] For any data packet obtained by the virtual switch, the software forwarding module can allocate the data packet to a receiving queue configured by a virtual network card in the virtual instance according to the metadata of the data packet and the data allocation rules stored locally, that is, RSS is implemented in the virtual instance.

[0091] Optionally, the process of determining the queue using the data allocation rule can refer to the description in the above-mentioned related embodiments, which will not be repeated here.

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

[0093] In the above process, the software forwarding module in the virtual switch can allocate different data packets to different queues configured by the virtual network card in the virtual instance by using a multi-queue receiving method, so that they can be processed by the processor cores 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 allocation rules, making the allocation of data packets more reasonable. And compared with using hardware to implement data packet forwarding, after the data allocation rules are directly configured in the software forwarding module, when the virtual instance is hot migrated to a new physical host, the data allocation rules can also be directly hot migrated, thereby eliminating the process of reconfiguring queue allocation rules on the new physical host.

[0094] In addition, for the contents not described in detail in this embodiment and the beneficial effects that can be achieved, please refer to the relevant descriptions in the above embodiments, and will not be repeated here.

[0095] Figure 7 Flow chart of another data packet processing method provided in an embodiment of the present application. Figure 7 As shown, the method may include: S201, receiving a first data packet sent by a hardware forwarding module in a virtual switch.

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

[0097] S203: Determine a target data allocation rule corresponding to the target virtual network card from the candidate data allocation rules stored in the software forwarding module.

[0098] S204, determining a target receiving queue from multiple queues configured in the target virtual network card according to the target data allocation rule, so that the target processor core bound to the target receiving queue processes the first data packet.

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

[0100] S206, sending the target flow table to the hardware forwarding module, so that the virtual switch puts the 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 flow, and the virtual switch receives the second data packet after the first data packet.

[0101] 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 flow after the first data packet, it can directly query the flow table to determine the target receiving queue.

[0102] In addition, for the contents not described in detail in this embodiment and the beneficial effects that can be achieved, please refer to the relevant descriptions in the above embodiments, and will not be repeated here.

[0103] 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 allocation rules in the software forwarding module, the virtual instance manager and the database. At the same time, it can also delete the flow table generated using the updated data allocation rules.

[0104] In addition, for the contents not described in detail in this embodiment and the beneficial effects that can be achieved, please refer to the relevant descriptions in the above embodiments, and will not be repeated here.

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

[0106] Figure 8 A schematic diagram of the structure of a data packet processing device provided in an embodiment of the present application. Figure 8 As shown, the device can be used as a software forwarding module in a virtual switch. The virtual switch is connected to at least one virtual network card in a virtual instance, any virtual network card in the virtual instance is configured with multiple receiving queues, and the virtual switch and the virtual instance are deployed in the same physical host, and the physical host includes multiple processor cores.

[0107] The device may include: The network card determination module 11 is used to determine the target virtual network card in the virtual instance according to the metadata of the first data packet.

[0108] The rule determination module 12 is used to determine the target data allocation rule corresponding to the target virtual network card from the candidate data allocation rules stored in the software forwarding module.

[0109] A queue determination module 13 is used to determine a target receiving queue from multiple queues configured in the target virtual network card according to the target data allocation rule, so that the target processor core bound to the target receiving queue processes the first data packet. Optionally, the metadata of the data packet includes five-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.

[0110] The queue determination module 13 is used 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; Determine 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.

[0111] Optionally, the target data allocation rule also includes a protocol type.

[0112] The device also includes: a queue determination module 13, which is used to input the four-tuple 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 allocation rule.

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

[0114] The device further includes a receiving module 14 , a flow table generating module 15 and a sending module 16 .

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

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

[0117] The sending module 16 is used to send the target flow table to the hardware forwarding module, so that the hardware forwarding module sends the second data packet to the target receiving queue configured by the target virtual network card according to the target flow table, the second data packet and the first data packet belong to the same data flow, and the hardware forwarding module receives the second data packet after the first data packet.

[0118] Optionally, a manager of the virtual instance is also deployed in the physical host where the virtual instance and the virtual switch are deployed.

[0119] The apparatus further comprises a rule management module 17, configured to receive a second data allocation rule sent by the virtual instance manager, wherein the virtual instance sends the second data allocation rule to the virtual instance manager in response to a rule update operation for the target virtual network card; Using the second data allocation rule to update the target data allocation rule in the candidate data allocation rule; 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.

[0120] Figure 8 The device shown can perform Figure 6 and Figure 7 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 6 and Figure 7The implementation process and technical effects of this technical solution refer to Figure 6 and Figure 7 The description in the illustrated embodiment will not be repeated here.

[0121] In a possible design, the data packet processing method provided in the above embodiments can be applied in an electronic device. The electronic device can function as a virtual switch, which is used to transmit data packets between virtual instances. The virtual instance can include at least one virtual network card, and any virtual network card is configured with multiple receiving queues. The virtual switch and the virtual instance can be deployed in the same physical host, and the physical host includes multiple processor cores.

[0122] like Fig. 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 Figure 6~Figure 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 .

[0123] The program includes one or more computer instructions, wherein the one or more computer instructions can implement the following steps when executed by the processor 21: Determine a target virtual network card in the virtual instance according to metadata of the first data packet; Determine, among the candidate data allocation rules stored in the software forwarding module, a target data allocation rule corresponding to the target virtual network card; 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.

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

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

[0126] Fig. 9 Only some components are shown schematically, which does not mean that the network components only include Fig. 9 In addition, Fig. 9 The components in are optional components, not mandatory components, and may depend on the product form of the network components. The electronic device of the embodiment of the present application may be a conventional server, a cloud server, a server array or other server-side devices.

[0127] 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 (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0128] The above-mentioned communication component 23 is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. 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 a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0129] The display 24 includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0130] The power supply assembly 25 described above provides power to various components of the device where the power supply assembly is located. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply assembly is located.

[0131] The above-mentioned audio component 26 can be configured to output and / or input audio signals. For example, the audio component includes a microphone (Microphone, MIC), and 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 an external audio signal. The received audio signal can be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal.

[0132] Accordingly, the embodiment of the present application also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the processor is enabled to implement each step in the above method embodiment. Among them, the computer-readable storage medium includes 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 technology, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic cassette, tape disk storage or other magnetic storage device or any other non-transmission medium Accordingly, the present application embodiment also provides a computer program product, the computer program product includes a computer program or an instruction, when the computer program or the instruction is executed by the processor, the processor is enabled to implement each step in the above method embodiment. It should be understood that each process or a combination of multiple processes in the above method flow can be implemented by a computer program or an instruction. In addition, these computer programs or instructions can be applied to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device, so that the processor of the general-purpose computer, the special-purpose computer, the embedded processor or other programmable data processing device can be implemented as a device for implementing the corresponding functions in the above method embodiment.

[0133] 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 it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions 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 and a virtual machine are deployed in the physical host, the virtual instance includes at least one virtual network card, any virtual network card is configured with multiple receiving queues, and the method is applied to a software forwarding module in the virtual switch; the method includes: Determine a target virtual network card in the virtual instance according to metadata of the first data packet; Determine, among the candidate data allocation rules stored in the software forwarding module, a target data allocation rule corresponding to the target virtual network card; According to the target data allocation rule, a target receiving queue is determined from a plurality of receiving queues configured in the target virtual network card, so that a target processor core associated with the target receiving queue processes the first data packet.

2. The method according to claim 1, characterized in that The metadata of the data packet includes five-tuple information of the data packet, the target data allocation rule includes a preset operator, a preset hash algorithm and an identification sequence, and the identification sequence includes queue identifications of the multiple receiving queues configured by the target virtual network card; Determining a target receiving queue from a plurality of queues configured for the target virtual network card according to the target data allocation rule includes: Inputting the four-tuple information in the five-tuple information of the first data packet and the preset operator into the preset hash algorithm; Determine 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 also includes a protocol type; the inputting the four-tuple information in the five-tuple 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, characterized in that The virtual switch further includes a hardware forwarding module; the metadata of the first data packet includes five-tuple information of the first data packet, and before determining the target virtual network card in the virtual instance according to the metadata of the first data packet, the method further includes: Receiving the first data packet sent by the hardware forwarding module; After determining the target receiving queue among the multiple queues configured by the target virtual network card, the method further includes: Generate a target flow table including the identifiers of the target virtual network card and the target receiving queue, and the five-tuple information; The target flow table is sent to the hardware forwarding module, so that the virtual switch sends a second data packet to the target receive queue configured by the target virtual network card according to the target flow table, the second data packet and the first data packet belong to the same data flow, and the virtual switch receives the second data packet after the first data packet.

5. The method according to claim 4, characterized in that A manager of a virtual instance is also deployed in the physical host; 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 for the target virtual network card; Using the to-be-updated data allocation rule to update the target data allocation rule in the candidate data allocation rule; 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.

6. A physical host, characterized in that: include: A plurality of 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 respectively configured with a plurality of receiving queues, and the virtual switch comprising a software forwarding module and an input and output module; The virtual instance is used to send the candidate data allocation 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; The manager is used to send the candidate data allocation rule to the software forwarding module; The software forwarding module is used to determine, in response to receiving a first data packet, a target virtual network card in the virtual instance according to metadata of the first data packet; Determine a target data allocation rule corresponding to the target virtual network card among the candidate data allocation rules; determine a target receiving queue among multiple 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; The target processor core bound to the target receiving queue is used to read and process the first data packet from the target queue.

7. The host according to claim 6, characterized in that: The virtual switch also includes a hardware forwarding module, in which a flow table is stored, and the flow table includes five-tuple information included in the metadata of the data packet; The hardware forwarding module is configured to receive a first data packet; if the metadata of the first data packet is not included in the flow table stored in the hardware forwarding module, the first data packet is sent to the software forwarding module; The software forwarding module is used to determine the target virtual network card and the target receiving queue in response to receiving the first data packet; and generate the target flow table; Sending the target flow table to the hardware forwarding module, the target flow table including the identity identifiers of the target virtual network card and the target receiving queue, and the five-tuple information of the first data packet; The hardware forwarding module is further configured to receive a second data packet after the first data packet; if the metadata of the second data packet is included in the target flow table stored in the hardware forwarding module, the target receiving queue is determined according to the target flow table, and the second data packet and the first data packet belong to the same data flow target receiving queue; The input-output module is used to put the second data packet into the target receiving queue.

8. The host according to claim 7, 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 used to forward the second data allocation rule to the software forwarding module; The software forwarding module is used 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.

9. The host according to claim 6, 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 queue identifications of the multiple receiving queues configured by the target virtual network card; The software forwarding module is used to input the four-tuple information of the first data packet and the preset operator into the preset hash algorithm; Determine 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.

10. The host according to claim 9, characterized in that: The target data allocation rule also includes a preset protocol type; The software forwarding module is used to input the four-tuple 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.

11. The host according to claim 6, characterized in that: The manager is 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 a software forwarding module of the hot upgraded virtual switch.

12. The host according to claim 6, 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 the start of the destination manager.

13. The host according to claim 6, characterized in that: The physical host further comprises: 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 post-failure recovery of the manager.

14. The host according to claim 6, 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, and the destination host includes a destination virtual instance, a destination manager, and a destination virtual switch; The source manager is used 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 migrates to the destination host, the destination manager sends the alternative data allocation rule to the software forwarding module of the destination virtual switch.

15. A virtual switch, characterized in that: include: Software forwarding module, hardware forwarding module and input and output module; The hardware forwarding module is used to receive a first data packet; If the flow table stored in the hardware forwarding module does not contain the metadata of the first data packet, sending the first data packet to the software forwarding module; The software forwarding module is used to store candidate data allocation rules; determine the target data allocation rule corresponding to the target virtual network card among the candidate data allocation rules; and determine the target virtual network card in the virtual instance according to the metadata of the first data packet in response to receiving the first data packet; According to the target data allocation rule, determining a target receiving queue from a plurality of receiving queues configured in the target virtual network card; The input-output module is used to put the first data packet into the target receiving queue.

16. The virtual switch according to claim 15, characterized in that: The software forwarding module is used to generate a target flow table including the identity identifiers of the target virtual network card and the target receiving queue, and the metadata; and send the target flow table to the hardware forwarding module; The hardware forwarding module is configured to receive a second data packet after the first data packet; if the target flow table contains metadata of the second data packet, the target receiving queue is determined according to the target flow table forwarding, and the second data packet and the first data packet belong to the same data flow; The input-output module is used to put the second data packet into the target receiving queue.

17. 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 executes the data packet processing method according to any one of claims 1 to 5.

18. A computer program product, characterized in that The computer program product comprises a computer program or instructions, so that the computer program or instructions can implement the steps in the data packet processing method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Multi-protocol-stack load balancing method and multi-protocol-stack load balancing device

    CN104639578A

  • Software intrusion detection system and method

    CN107181738A

  • Shunting method, device and system, processing equipment and storage medium

    CN111371694A

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

    CN112437023A

  • Message processing method, programmable network card device, physical server and storage medium

    CN115766620A

Cited By

  • Data processing unit, communication method and system, medium, and computer program product

    CN122160347A