A method and device for unloading a stream

By processing and separating the flow of virtual network data packets in the host and sending appropriate streams to the physical network card, the performance degradation caused by the physical network card not supporting rules in the virtual network is solved, and more efficient virtual network performance and resource utilization are achieved.

CN114968471BActive Publication Date: 2024-12-03CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110220241.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-26
Publication Date
2024-12-03
Estimated Expiration
2041-02-26

AI Technical Summary

Technical Problem

When existing smart NICs deal with virtual networks, rules that are not supported by physical network cards lead to degradation of virtual network performance, hardware offloading functions cannot be fully utilized, and it is difficult to manage and schedule flexibly.

Method used

By determining in the host the first set of streams required to process the data packets, the second stream supported by the physical network card is found, and the intermediate stream and the third stream are flows other than the second stream, Implement processing of rules that are not supported by physical network cards and direct offloading of other streams, reducing kernel interaction and CPU burden.

Benefits of technology

It improves the performance of the virtual network, increases the number of offloadable streams of physical network cards, reduces frequent kernel interactions and CPU burden, and improves the processing efficiency of the virtual network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114968471B_ABST
    Figure CN114968471B_ABST
Patent Text Reader

Abstract

The present application discloses a flow unloading method and device, which are applied to a host of an electronic device, wherein the host determines a first flow required for processing a first data packet, and the first flow constitutes a first flow set; the first flow includes at least one rule required for processing the first data packet; the host searches for a second flow from the first flow set according to the first rule set; the second flow constitutes a second flow set; the first rule in the first rule set is a rule supported by the physical network card; the host processes the second flow to obtain an intermediate flow; the host sends the intermediate flow and a third flow to the physical network card of the electronic device; the third flow is a flow in the first flow set except the second flow, so that the second flow related to the rule not supported by the physical network card is processed and unloaded to the physical network card, and the flows other than the second flow are directly unloaded to the physical network card, thereby improving the performance of the virtual network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and relate to but are not limited to a method and device for unloading a flow. Background Art

[0002] Network virtualization technology allows non-physical computing entities such as virtual machines and containers to transfer data, and also allows them to interact with real physical networks. In network virtualization technology, virtual switches are software that handles data exchange. This data exchange is inefficient at the cost of frequent kernel interactions and a large amount of CPU consumption.

[0003] In order to improve the performance of network virtualization, Single-Root I / O Virtualization (SR-IOV) technology has begun to be applied. SR-IOV technology enables virtual machines to directly connect with physical network interface cards (NICs), such as physical network cards, and other peripheral component interconnect express (PCIe) devices, bypassing the central processing unit (CPU) and kernel on the host, reducing the copying and calculation of data packets, greatly improving the efficiency of data exchange, and making the performance of virtual networks close to that of physical networks.

[0004] SR-IOV is a physical transparent transmission technology that bypasses the host kernel, which makes it impossible for the virtual switch on the host to perceive the SR-IOV transparent devices and manage them through flows like it perceives kernel devices. Therefore, although SR-IOV technology has excellent performance, it is difficult to flexibly manage and schedule for network virtualization, which is not conducive to its widespread use.

[0005] Nowadays, intelligent NICs can offload virtual switch flows to NICs, which enables flexible management of transparent transmission devices. By offloading common network packet rules and flow models to physical NICs, the calculation of these network packets and flow models can be processed in the physical NICs. Compared with processing flows in the host, physical NICs can process flows more efficiently, reduce the resource pressure of the host, and reduce CPU and memory consumption.

[0006] In the related art, the scheme of unloading packets includes: the host maintains a rule set for a virtual machine, and the physical network interface card (NIC) maintains a flow table for the virtual machine, and the physical NIC receives and processes network packets, i.e., data packets, associated with the virtual machine. Wherein, when the network packet matches the flow in the flow table at the physical NIC, the physical NIC performs an action on the network packet based on the matching flow to process the network packet. Alternatively, when the network packet does not match the flow in the flow table at the physical NIC, the physical NIC passes the network packet to the primary partition for processing against the rule set.

[0007] The above solution can solve the problem that physical transparent transmission devices cannot be managed by virtual switches, but with the increase of business and the adjustment of demand, the virtual switch rule set is often adjusted accordingly. However, after the hardware leaves the factory, its operating logic and support functions cannot be changed. Therefore, there will be rules that are not supported by the network interface card. When the rules for processing a data packet include rules that are not supported by the physical network card, the physical network card sends the data packet to the host, and the host processes the data packet, resulting in a significant decrease in virtual network performance and the inability to fully utilize the hardware offload function. Summary of the invention

[0008] The embodiments of the present application provide a flow unloading method, device, and storage medium, which can unload the second flow related to the rules not supported by the physical network card after processing to the physical network card, and directly unload the flows other than the second flow to the physical network card, thereby improving the performance of the virtual network.

[0009] The technical solution of the embodiment of the present application is implemented as follows:

[0010] An embodiment of the present application provides a flow unloading method, which is applied to a host of an electronic device, wherein the electronic device further includes a physical network card, and the method includes:

[0011] Determine a first flow required for processing a first data packet, the first flow constituting a first flow set; the first flow includes at least one rule required for processing the first data packet;

[0012] According to the first rule set, searching for a second flow from the first flow set; the second flow constitutes a second flow set; the first rule in the first rule set is a rule supported by the physical network card;

[0013] processing the second stream to obtain an intermediate stream;

[0014] The intermediate flow and the third flow are sent to the physical network card of the electronic device, and the third flow is a flow in the first flow set except the second flow.

[0015] The embodiment of the present application provides a flow processing method, which is applied to an electronic device, wherein the electronic device includes: a host and a physical network card, and the method includes:

[0016] The host determines a first flow required for processing a first data packet, the first flow constituting a first flow set; the first flow includes at least one rule required for processing the first data packet;

[0017] The host searches for a second flow from the first flow set according to a first rule set; the second flow constitutes a second flow set; the first rule in the first rule set is a rule supported by the physical network card;

[0018] The host processes the second stream to obtain an intermediate stream;

[0019] The host sends the intermediate flow and the third flow to the physical network card of the electronic device; the third flow is a flow in the first flow set except the second flow; the intermediate flow and the third flow constitute a third flow set;

[0020] The physical network card processes the flows in the third flow set when receiving the second data packet associated with the first data packet.

[0021] The embodiment of the present application provides a stream processing device, which is applied to a host of an electronic device, wherein the electronic device further includes a physical network card, and the device includes:

[0022] A first determining module, configured to determine a first flow required for processing a first data packet, wherein the first flow constitutes a first flow set; the first flow includes at least one rule required for processing the first data packet;

[0023] A search module, configured to search for a second flow from the first flow set according to a first rule set; the second flow constitutes a second flow set; the first rule in the first rule set is a rule supported by the physical network card;

[0024] A processing module, used for processing the second stream to obtain an intermediate stream;

[0025] The sending module is used to send the intermediate flow and the third flow to the physical network card of the electronic device; the third flow is the flow in the first flow set except the second flow.

[0026] An embodiment of the present application provides an electronic device, the device comprising: a host and a physical network card;

[0027] The host is used to determine a first flow required for processing a first data packet, the first flow constituting a first flow set; the first flow includes at least one rule required for processing the first data packet;

[0028] The host is further used to search for a second flow from the first flow set according to a first rule set; the second flow constitutes a second flow set; the first rule in the first rule set is a rule supported by the physical network card;

[0029] The host is further used to process the second stream to obtain an intermediate stream;

[0030] The host is further configured to send the intermediate flow and the third flow to the physical network card, wherein the third flow is a flow in the first flow set except the second flow; the intermediate flow and the third flow constitute a third flow set;

[0031] The physical network card is configured to process flows in the third flow set upon receiving a second data packet associated with the first data packet.

[0032] An embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above-mentioned stream unloading method when executing the computer program.

[0033] The embodiment of the present application further provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned flow unloading method is implemented.

[0034] The flow unloading method, device and storage medium provided in the embodiment of the present application, the electronic device includes: a host and a physical network card, the host determines a first flow required for processing a first data packet, the first flow constitutes a first flow set; the first flow includes at least one rule required for processing the first data packet; the host searches for a second flow from the first flow set according to the first rule set; the second flow constitutes a second flow set; the first rule in the first rule set is a rule supported by the physical network card; the host processes the second flow to obtain an intermediate flow; the host sends the intermediate flow and a third flow to the physical network card; the third flow is a flow in the first flow set except the second flow; so that when the flow for processing a certain data packet includes a rule that is not supported by the physical network card, the data packet is sent to the host, and the flows related to the rules that are not supported by the physical network card are processed by the host and then sent to the physical network card, and the other flows are directly sent to the physical network card for processing by the physical network card, while completing the processing of the data packet, the number of flows that can be unloaded to the physical network card is increased, the frequent kernel interaction and the burden on the CPU are reduced, and the performance of the virtual network is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 An optional structural diagram of a data processing system provided in an embodiment of the present application;

[0036] Figure 2 An optional structural diagram of an electronic device provided in an embodiment of the present application;

[0037] Figure 3 A schematic diagram of an optional flow chart of a method for unloading a stream provided in an embodiment of the present application;

[0038] Figure 4 A schematic diagram of an optional flow chart of a method for unloading a stream provided in an embodiment of the present application;

[0039] Figure 5 A schematic diagram of an optional flow chart of a method for unloading a stream provided in an embodiment of the present application;

[0040] Figure 6 An optional flow diagram of a method for unloading a stream provided in an embodiment of the present application;

[0041] Fig. 7A An optional structural diagram of an electronic device provided in an embodiment of the present application;

[0042] Figure 7B A schematic diagram of an optional flow chart of a method for unloading a stream provided in an embodiment of the present application;

[0043] Fig. 8A An optional structural diagram of an electronic device provided in an embodiment of the present application;

[0044] Figure 8B A schematic diagram of an optional flow chart of a method for unloading a stream provided in an embodiment of the present application;

[0045] Figure 8C A schematic diagram of an optional flow chart of a method for unloading a stream provided in an embodiment of the present application;

[0046] Fig. 9 A schematic diagram of an optional flow chart of a method for unloading a stream provided in an embodiment of the present application;

[0047] Fig.10 An optional structural diagram of a flow unloading device provided in an embodiment of the present application;

[0048] Fig.11 An optional structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.

[0050] The embodiments of the present application can provide a method and device for unloading a stream, and a storage medium. In practical applications, the method for unloading a stream can be implemented in an electronic device, and each functional entity in the electronic device can be collaboratively implemented by hardware resources of the electronic device (such as a terminal device, a server), such as computing resources such as a processor, and communication resources (such as for supporting various communication methods such as optical cables and cellular).

[0051] The flow unloading method provided in the embodiment of the present application is applied to a data processing system, and the data processing system is composed of a data packet generating end and a data packet processing end.

[0052] As an example, the structure of the data processing system can be as follows Figure 1 As shown, the data packet generating end 10 and the data packet processing end 20 are included. The data packet generating end 10 and the data packet processing end 20 are different physical entities, and the data packet generating end 10 and the data packet processing end 20 interact with each other through a network 30.

[0053] Here, a browser or application program capable of accessing a web page is installed on the data packet generating end 10, and the user operates the browser or application program to send a data packet to the data packet processing end 20. The data packet processing end 20 processes the received data packet.

[0054] like Figure 2 As shown, the packet processing end 20, i.e., the electronic device, includes a host 201 and a physical network card 202; the host 201 provides a virtualized environment. For example, the host 201 can provide a virtualized hardware environment for a main operating system and a virtual machine. The physical network card 202 includes physical hardware that can be virtualized and connected to other computer systems and / or networks using one or more physical interfaces. Figure 2 In the figure, only one physical network card is shown. In actual application, the data packet processing end 20 may include multiple physical network cards.

[0055] In the embodiment of the present application, when the data packet generation end 10 sends a first data packet to the data packet processing end 20, the data packet processing end 20 performs the following processing on the first data packet:

[0056] The host 201 determines the first flow required for processing the first data packet, and the first flow constitutes a first flow set; the first flow includes at least one rule required for processing the first data packet; the host searches for a second flow from the first flow set according to the first rule set; the second flow constitutes a second flow set; the first rule in the first rule set is a rule supported by the physical network card; the host processes the second flow to obtain an intermediate flow; the host 201 sends the intermediate flow and a third flow to the physical network card 202, and the third flow is a flow in the first flow set except the second flow. The physical network card 202 processes the intermediate flow and the third flow to complete the processing of the first data packet.

[0057] Combination Figure 1 or Figure 2 The data processing system shown in the embodiment proposes a flow unloading method. When the rules for processing a certain data packet include rules that are not supported by the physical network card, the data packet is sent to the host. For the flows related to the rules that are not supported by the physical network card, the host processes them and then sends them to the physical network card. For other flows, they are directly sent to the physical network card and processed by the physical network card. While completing the processing of the data packet, the number of unloadable flows is increased, the frequent kernel interactions and the burden on the CPU are reduced, and the performance of the virtual network is improved.

[0058] Next, combine Figure 1 or Figure 2 The schematic diagram of the data processing system shown illustrates various embodiments of the stream unloading method and device, and storage medium provided in the embodiments of the present application.

[0059] This embodiment provides a method for unloading a stream, which is applied to an electronic device. The function implemented by the method can be implemented by calling a program code by a processor in the electronic device, and of course the program code can be stored in a computer storage medium. It can be seen that the electronic device at least includes a processor and a storage medium.

[0060] The electronic device may be any device with information processing capabilities. In one embodiment, the electronic device may be a smart terminal, such as a notebook or other electronic device with wireless communication capabilities, an AR / VR device, or a mobile terminal. In another embodiment, the electronic device may also be a terminal device with computing functions that is inconvenient to move, such as a desktop computer, a desktop computer, etc. In yet another embodiment, the electronic device may also be a server, such as a cloud server, etc.

[0061] Of course, the embodiments of the present application are not limited to being provided as methods and hardware, and there may be multiple implementations, such as providing as a storage medium (storing instructions for executing the stream unloading method provided by the embodiments of the present application).

[0062] based on Figure 2The structure of the electronic device shown, Figure 3 FIG. 1 is a schematic diagram of an implementation flow of a method for unloading a stream applied to a host according to an embodiment of the present application. Figure 3 As shown, the method comprises the following steps:

[0063] S301: Determine a first flow required for processing a first data packet.

[0064] The first streams constitute a first stream set.

[0065] The first data packet is the first network packet received by the electronic device, that is, the network packet has not been received before. Here, the electronic device can receive the first data packet sent by other computer devices or networks through a physical network card.

[0066] After the physical network card in the electronic device receives a network packet, the physical network card determines whether the received network packet is a network packet that has been received before. If it is a network packet that has been received before, the physical network card directly calls the flow used to process the network packet, executes the action of the called flow, and directly processes the network packet. If it is a network packet that has not been received before, it is a network packet received for the first time, that is, the first data packet. The physical network card determines the rules required to process the first data packet, and matches the determined rules with the first rule set to determine whether the physical network card can directly process the first data packet. If the physical network card can directly process the first data packet, the flow corresponding to each rule is called, and the action of the called flow is executed to process the first data packet. If the physical network card cannot directly process the first data packet, the first data packet is sent to the host. Here, the rules supported by the physical network card are referred to as first rules, and the rules constituted by the first rules are referred to as the first rule set.

[0067] After receiving the first data packet sent by the physical network card, the host parses the first data packet, determines the header information and action information of the first data packet, and obtains the first flow required for processing the first data packet according to the header information and action information of the first data packet. The first flow includes at least one rule required for processing the first data packet; the first flows required for processing the first data packet constitute a first flow set, and the first flow set includes multiple first flows.

[0068] In an example, the first data packet is data packet A, and the first flow set corresponding to data packet A includes 20 first flows: flow 1, flow 2 to flow 20.

[0069] In the embodiment of the present application, a flow is a management protocol for processing a series of sequentially sent message sets with the same attributes passing through the same network within the same period of time.

[0070] In one example, host A uses the FTP protocol at the application layer to transfer a file to host B. The file is divided into 100,000 messages at the network layer, with source IP A and destination IP B. The transport layer protocol is TCP, with source port number 2000 and destination port number 21. In the same time period, host C uses the FTP protocol at the application layer to transfer a file to host B. The file is divided into 200,000 messages at the network layer, with source IP C and destination IP B. The transport layer protocol is TCP, with source port number 3000 and destination port number 21. When the management protocol focuses on messages with destination IP B and destination TCP port number 21, these 300,000 messages can be abstracted into a stream, so that these 30 messages can be processed through the abstracted stream. When the management protocol is also about the source IP, the messages sent by host A can be processed through one stream, and the messages sent by host B can be processed through one stream.

[0071] In an embodiment of the present application, a flow includes at least one rule, which is an element that constitutes the flow. The rule includes: source Internet Protocol (IP) address, destination IP address, source port, destination port, transport layer protocol, source MAC address, destination MAC address, action information, etc.

[0072] In the above example, when the management protocol focuses on the message whose destination IP is B and destination TCP port number is 21, the flow includes the following rules: IP is B and destination TCP port number is 21; when the management protocol is also about the message whose source IP is A, the flow includes the following rules: source IP is A, IP is B and destination TCP port number is 21.

[0073] S302: Search for a second flow from the first flow set according to a first rule set.

[0074] The second flows constitute a second flow set, and the first rule in the first rule set is a rule supported by the physical network card.

[0075] The host obtains a first rule set supported by the physical network card, and matches the first rule set with the rules involved in each first flow in the first flow set, searches for a first flow whose rules include a third rule that is not supported by the physical network card, and uses the searched first flow as the second flow, and the searched second flow constitutes a second flow set. The second flow set includes the first or multiple second flows. Here, when the first flow includes a rule but the rule is not the first rule, the rule is called the third rule.

[0076] In the embodiment of the present application, for a second flow, the second flow may include one of the following situations:

[0077] Case 1: The physical network card does not support the flow.

[0078] Case 2: The physical network card does not support the supported streams and the streams that the implementation of the supported streams depends on;

[0079] Case 3: Unsupported flows that are not supported by the physical network card, flows that the implementation of unsupported flows depends on, and flows that depend on unsupported flows.

[0080] Here, when the first stream set includes a stream on which an implementation that does not support the stream depends, the second stream included in the second stream set may be as shown in Case 2.

[0081] The rules involved in the second flow in the second flow set may include the third rule or may not include the third rule. The rules involved in the unsupported flow include the third rule, i.e., the flow not supported by the physical network card, and the rules involved in the fourth flow do not include the third rule, which is a flow supported by the physical network card, but is related to the third rule based on the dependency relationship with the flow involved in the third rule.

[0082] In actual applications, the host may search for one or more second flow sets from the first flow set.

[0083] In one example, the first data packet is data packet A, and the first flow set corresponding to data packet A includes 20 first flows: flow 1, flow 2 to flow 20. Among them, flow 2 constitutes a second flow set, and flow 5, flow 6 and flow 7 constitute a second flow set, the rules involved in flow 2 include rules that are not supported by the physical network card, the rules involved in flow 7 include rules that are not supported by the physical network card, the implementation of flow 7 depends on the processing result of flow 6, and the implementation of flow 6 depends on the processing result of flow 5.

[0084] In another example, the first data packet is data packet B, and the first flow set corresponding to data packet B includes 10 first flows: flow 1, flow 2 to flow 10. Among them, flow 3, flow 4 and flow 5 constitute a second flow set, and the rules involved in flow 5 include rules that are not supported by the physical network card, and the implementation of flow 5 depends on the processing results of flow 4 and flow 3.

[0085] In practical applications, the fourth flow may also include flows that depend on unsupported flows. In one example, the first data packet is data packet B, and the first flow set corresponding to data packet B includes 10 first flows: flow 1, flow 2 to flow 10. Among them, flow 3, flow 4, flow 5 and flow 8 constitute a second flow set, and the rules involved in flow 5 include rules that are not supported by the physical network card. The implementation of flow 5 depends on the processing results of flow 4 and flow 3, and the implementation of flow 8 depends on the processing result of flow 5.

[0086] S303: Process the second stream to obtain an intermediate stream.

[0087] After the host finds the second flow set in the first flow set, it performs flow merging processing on the second flow in the second flow set to obtain an intermediate flow, wherein one second flow set corresponds to one intermediate flow.

[0088] S304: Send the intermediate stream and the third stream to the physical network card of the electronic device.

[0089] The third stream is a stream in the first stream set excluding the second stream.

[0090] After the host obtains the intermediate flow, it sends the unprocessed flows in the first flow set, namely the third flow and the intermediate flow, to the physical network card. The physical network card processes the sent third flow and the intermediate flow to process the first data packet, thereby realizing the unloading of part of the flow of the first data packet to the physical network card.

[0091] In one example, the first data packet is data packet A, and the first flow set corresponding to data packet A includes 20 first flows: flow 1, flow 2 to flow 20. Among them, flow 2 constitutes a second flow set, and flow 5, flow 6 and flow 7 constitute a second flow set. The host processes flow 2 to obtain flow 2', processes flow 5, flow 6 and flow 7 to obtain flow 5', and sends flow 1, flow 2', flow 3, flow 4, flow 5', flow 8 to flow 20 to the physical network card.

[0092] In another example, the first data packet is data packet B, and the first flow set corresponding to data packet B includes 10 first flows: flow 1, flow 2 to flow 10. Among them, flow 3, flow 4 and flow 5 constitute a second flow set, and the host processes flow 3, flow 4 and flow 5 to obtain flow 3', and sends flow 1, flow 2, flow 3', flow 6 to flow 10 to the physical network card.

[0093] The flow unloading method provided in the embodiment of the present application can be applied to the following scenarios:

[0094] Scenario 1: When a first data packet needs to process 60 flows, among which 3 flows involve rules that are not supported by the physical network card, the host processes the 3 flows and directly offloads 57 flows to the physical network card for processing.

[0095] Scenario 2: When the processing of a first data packet requires 60 flows, among which, the rules involved in 3 flows include rules that are not supported by the physical network card, and 5 flows have dependencies on the 3 flows, the host processes the 8 flows and directly offloads 52 flows to the physical network card for processing.

[0096] The flow unloading method provided in the embodiment of the present application is as follows: the host of the electronic device determines the first flow required to process the first data packet, and the first flow constitutes a first flow set; according to the first rule set, the second flow is searched from the first flow set; the second flow constitutes a second flow set; the second flow is related to the first rule in the first rule set; the first rule is a rule supported by the physical network card; the second flow is processed to obtain an intermediate flow; the intermediate flow and the third flow are sent to the physical network card; the third flow is a flow in the first flow set except the second flow; so that when the rules for processing a certain data packet include rules that are not supported by the physical network card, the data packet is sent to the host, and the flows related to the rules that are not supported by the physical network card are processed by the host and then sent to the physical network card. For other flows, they are directly sent to the physical network card and processed by the physical network card. While completing the processing of the data packet, the number of unloadable flows is increased, the frequent kernel interactions and the burden on the CPU are reduced, and the performance of the virtual network is improved.

[0097] In some embodiments, Figure 4 As shown, the implementation of S301 includes:

[0098] S3011. Determine a second rule set according to the header information of the first data packet and the action information required when the first data packet is processed.

[0099] The second rule set is composed of rules required for processing the first data packet, and the action information represents the action when processing the first data packet.

[0100] S3012: Combine the rules with association relationship in the second rule set to obtain the first flow constituting the first flow set.

[0101] In the embodiment of the present application, the rule can be determined by the rule condition and the rule action, that is, the action information.

[0102] The rule conditions required for processing the first data packet may be determined by a tuple in the header information of the first data packet, wherein the tuple in the header information may include any combination of fields suitable for the network protocol and hardware device used. The tuple may include, for example, a source network protocol (Internet Protocol, IP) and / or a destination IP address, a source and / or a destination port, a transport layer protocol, a source and / or a destination hardware address (e.g., an Ethernet MAC address), or a combination thereof. The transport layer protocol may include: a Transmission Control Protocol (TCP), a User Datagram Protocol (UDP). The hardware address may include a Media Access Control Address (MAC address).

[0103] In one example, the tuple is '192.168.0.*,*,*,*,TCP', and its rule condition is: it will match any network packet on the 192.168.0.* network with any source IP address, any source port, any destination IP address, any destination port, and using the TCP protocol.

[0104] In an embodiment of the present application, the action information in the first data packet is used to indicate how the electronic device should process the matching data packet after receiving it, that is, the action to be performed, which may indicate actions such as rejection, permission, network address translation, mapping, metering, decapsulation, and encapsulation.

[0105] In one example, a rule determined by a rule condition (tuple) and a rule action may specify that UDP packets from a particular IP address are allowed.

[0106] In another example, a rule determined by a rule condition and a rule action may specify that TCP packets sent to any destination having a specified port are subject to Network Address Translation (NAT).

[0107] After determining the rule of the first data packet, the host combines the rules required to process the data packet to obtain a corresponding flow.

[0108] In one example, for example, the header information of the first data packet includes: in_port=port0, sip=192.168.1.5, smac=fa:16:e3:55:7a:81, type=tcp, dip=10.1.1.5, dmac=7e:6b:1c:9a:b1:1a, actions=nat(mod_sip(10.1.1.20)), out_put=port1, and the header information indicates that the source IP address coming in from port0 is 192.168.1.5, The message with source MAC address of fa:16:e3:55:7a:81, destination IP address of 10.1.1.5 and destination MAC address of 7e:6b:1c:9a:b1:1a is subjected to NAT action of source IP conversion, wherein the required actions include: source IP address modification and data sending, then the rules include: source IP address is changed to 10.1.1.20, sent from port1, and there is an association relationship between the two rules, after executing the source IP address change to 10.1.1.20, port1 is sent, and the corresponding flow is obtained based on the association relationship between the two rules.

[0109] In some embodiments, Figure 5 As shown, the implementation of S302 includes:

[0110] S3021. Match the rules included in each first flow in the first flow set with the first rule set to determine a third rule.

[0111] The third rule is a rule included in the first flow but not included in the first rule set.

[0112] S3022: Determine that the first flow including the third rule is an unsupported flow.

[0113] The unsupported flow is a flow that is not supported by the physical network card.

[0114] S3023. Determine the second flow set according to the unsupported flow.

[0115] Here, the host stores the first rule set, analyzes the rules involved in each first flow in the first flow set, traverses the first flow, and matches the rules included in each first flow with the first rule in the first rule set. The first flow includes a rule that is not included in the first rule set as the third rule, and the first flow including the third rule is determined as an unsupported flow.

[0116] In one example, flow A includes: rules 1, 2, and 3, flow B includes: rules 2, 3, and 6, and the rules in the first rule set include: rules 1, 2, 3, and 4. The rules included in flow A all match the first rule set, and the flow is not unsupported. Flow B includes rule 6, and the first rule set does not include rule 6. In this case, rule 6 is the third rule, and flow B is not an unsupported flow.

[0117] After determining that the flow is not supported, the host searches the first flow set for a fourth flow that the unsupported flow depends on based on the unsupported flow, so as to determine the second flow set.

[0118] In some embodiments, the implementation of S3023 includes:

[0119] From the first flow set, search for a fourth flow that has a dependency on the unsupported flow; when the first flow set includes the fourth flow, construct the second flow set based on the unsupported flow and the fourth flow; when the first flow set does not include the fourth flow, construct the second flow set based on the unsupported flow.

[0120] If the host finds the fourth flow in the first flow set, both the unsupported flow and the fourth flow are added to the second flow set. If the host does not find the fourth flow in the first flow set, the unsupported flow is added to the second flow set.

[0121] In some embodiments, Figure 6 As shown, the implementation of S304 includes:

[0122] S3041. Determine a third flow that is not processed in the first flow set;

[0123] S3042: construct a third flow set based on the third flow and the intermediate flow;

[0124] S3043. Send the third flow set to the physical network card.

[0125] Here, after obtaining the intermediate flow, the host sends the flows in the first flow set except the second flow as unprocessed third flows together with the intermediate flow to the physical network card. The host can form a flow table based on the flows in the third flow set and send the formed flow table to the physical network card.

[0126] In one example, the first data packet is data packet A, and the first flow set corresponding to data packet A includes 20 first flows: flow 1, flow 2 to flow 20. Among them, flow 2 constitutes a second flow set, and flows 5, flow 6 and flow 7 constitute a second flow set. The host processes flow 2 to obtain the intermediate flow 2', processes flows 5, flow 6 and flow 7 to obtain the intermediate flow 5', and sends the third flow set consisting of flow 1, flow 2', flow 3, flow 4, flow 5', flow 8 to flow 20 to the physical network card.

[0127] In another example, the first data packet is data packet B, and the first flow set corresponding to data packet B includes 10 first flows: flow 1, flow 2 to flow 10. Among them, flow 3, flow 4 and flow 5 constitute a second flow set, and the host processes flow 3, flow 4 and flow 5 to obtain the intermediate flow 3', and sends the third flow set consisting of flow 1, flow 2, flow 3', flow 6 to flow 10 to the physical network card.

[0128] In some embodiments, Figure 2 On the basis of Fig. 7A As shown, the host 201 includes a virtual switch 2011, which is configured to inspect and manipulate network packets sent and received by any hosted virtual machine according to a general rule / flow model. For example, based on defined rules and flows, the virtual switch 104 can allow packets, block packets, reroute packets, perform NAT, or perform any network packet processing applicable to the networking technology and equipment used.

[0129] In some embodiments, the host further implements the following steps: obtaining the fourth rules supported by the virtual switch of the host to form a fourth rule set; combining the fourth rules in the fourth rule set to obtain a fifth flow; a fifth flow includes at least one fourth rule; sending the fifth flow to the physical network card so that the physical network card processes the fifth flow and feeds back the processing result to the host; and determining the first rule set based on the processing result.

[0130] In the embodiment of the present application, the rules supported by the virtual switch are the rules supported by the host. The physical network card may not support the rules supported by the virtual switch, but the virtual switch must support the rules supported by the physical network card.

[0131] Here, in order to determine the rules supported by the physical network card, the host obtains the fourth rule set supported by the virtual switch, combines the fourth rules in the fourth rule set to obtain at least one fifth flow, sends the fifth flow to the physical network card, and detects the feedback result of the physical network card.

[0132] In one example, the fourth rule set supported by the virtual switch includes the following fourth rule set: first IP, second IP, third IP, first MAC, and second MAC, which can constitute the fifth flow: (first IP, first MAC), (first IP, second MAC), (second IP, first MAC), (second IP, second MAC), (third IP, first MAC), and (third IP, second MAC).

[0133] In the embodiment of the present application, the fourth rule in the fourth rule set can be combined according to a set combination strategy to obtain a fifth flow, and the combination strategy can be set according to actual needs.

[0134] After receiving the feedback result of the physical network card, determine which rules the physical network card supports and which rules the physical network card does not support according to the feedback result of the physical network card, and the rules supported by the physical network card constitute a first rule set. The feedback result of the physical network card indicates whether the flow sent to the physical network card can be processed. In one example, the feedback result includes the identifier of the flow that is uninstalled, that is, the flow that can be processed. In one example, the feedback result includes the identifier of the flow that is not uninstalled, that is, the flow that cannot be processed.

[0135] In the embodiment of the present application, the host may collect a first rule set consisting of rules supported by the physical network card when the virtual switch is started.

[0136] based on Figure 2 The electronic device shown in the figure, the embodiment of the present application provides a method for processing a stream applied to the electronic device, such as Figure 7B As shown, including:

[0137] S701. The host determines a first flow required to process a first data packet.

[0138] The first flow constitutes a first flow set; the first flow includes at least one rule required for processing the first data packet;

[0139] S702: The host searches for a second flow from the first flow set according to a first rule set; the second flow constitutes a second flow set.

[0140] The first rule in the first rule set is a rule supported by the physical network card.

[0141] S703: The host processes the second stream to obtain an intermediate stream.

[0142] S704: The host sends the intermediate stream and the third stream to the physical network card of the electronic device.

[0143] The third flow is a flow in the first flow set excluding the second flow; the intermediate flow and the third flow constitute a third flow set; and the physical network card of the electronic device processes the third flow in the third flow set when receiving a second data packet associated with the first data packet.

[0144] S705. When receiving a second data packet associated with the first data packet, the physical network card processes a flow in the third flow set.

[0145] After receiving the data packet sent again from the connected computer device or network, the physical network card determines the relationship between the received data packet and the first data packet, and if the received data packet is a second data packet associated with the first data packet, directly processes the flow in the third flow set to complete the processing of the second data packet. If the received data packet is not the second data packet associated with the first data packet, the data packet is processed according to the processing of the first data packet.

[0146] In the embodiment of the present application, the description of S701 to S704 in FIG. 7 can be found in Figure 3 The description of the host in is not repeated here.

[0147] In some embodiments, after the host sends the intermediate stream and the third stream to the physical network card of the electronic device, the physical network card further implements the following steps:

[0148] The physical network card receives a new data packet;

[0149] The physical network card obtains the header information of the new data packet, and compares the header information of the new data packet with the header information of the first data packet;

[0150] When the header information of the new data packet matches the header information of the first data packet, the physical network card determines that the second data packet is received.

[0151] When the header information of the new data packet matches the header information of the first data packet, the flow required to characterize the new data packet is the same as the flow for processing the first data packet. The matching can be performed by the tuple in the header information, that is, the tuple in the header information of the new data packet is matched with the tuple in the header information of the first data packet. In one example, the tuple to be matched includes at least one of the following information: source IP address, destination IP address, source MAC address, destination MAC address, port number, sequence number, etc.

[0152] Below, the flow unloading method provided in the embodiment of the present application is further explained through a specific application scenario.

[0153] When the virtual switch is started, the rule set B supported by the physical network card, i.e., the first rule set, is collected. Rule set B is compared with rule set A, i.e., the second rule set, which the virtual switch currently needs to support, and rule set C, i.e., the third rule set, which is not supported by the physical network card is recorded, where C = A∩(A∩B). The flows involved in the rules in rule set C are merged in the host, and the processed flows, i.e., the intermediate flows, are unloaded to the physical network card, which can increase the number and proportion of flows unloaded in the virtual switch and improve the performance of the virtual network.

[0154] The structure of the virtual network computer system provided in the embodiment of the present application is shown in FIG8 , and includes: a host 801 , a virtual machine 802 , and a physical NIC 803 .

[0155] The host 801 provides a virtualized environment. For example, the host 801 may include a parent partition (executing a main operating system) and one or more child partitions. Each child partition may be considered to provide a virtualized hardware environment for executing a corresponding virtual machine 802. In some embodiments, the host 801 is used as part of a cloud computing environment that provides virtual machines to tenants.

[0156] The virtual machine 802 executes one or more virtualized applications, such as an operating system, application software, etc. As shown in the figure, the virtual machine 802 includes a network protocol stack 8021 (e.g., a TCP / IP stack) and a virtual NIC driver 8022. Using the network protocol stack 8021 and the virtual NIC driver 8022, the virtual machine 802 can send and / or receive network packets and other information on a virtual bus 8023 through the host 801 and / or on a data path 8024 through a physical NIC 803.

[0157] The physical NIC 803 includes physical hardware that can be virtualized and connected to other computer systems and / or networks using one or more external interfaces 8031. The physical NIC 803 includes a virtual bridge 8032. The virtual bridge 8032 bridges the virtual function 8033 and the physical function 8034 at the physical NIC 803, and performs packet inspection and manipulation. The virtual bridge 8032 works with the virtual switch 8011 at the host 801 to regulate network communications. In this way, the physical NIC 803 can expose one or more virtual functions to one or more virtual machines 802 hosted at the host 801. In addition, the physical NIC 803 can expose one or more physical functions to the host 801. The virtual bridge 8032 includes a module: flow processing 8321 to process the flow offloaded to the physical network card.

[0158] Here, although only one virtual machine 802 and one physical NIC 803 are shown in FIG. 8 , the computer architecture may include any number of virtual machines and any number of physical NICs.

[0159] The physical NIC 803 presents the physical function 8034 to the host 801. The host 801 includes a corresponding physical function driver 8012, and the data path 8013 connects the physical function 8034 of the physical NIC 803 and the physical function driver 8012 at the host 801. In this way, the physical function 8034 and the physical function driver 8012 can operate to exchange network packets between the physical NIC 803 and the host 801. For example, the physical function driver 8012 can communicate with the virtual switch 8022 at the host 801, and the physical function 8034 can communicate with the virtual bridge 8032 at the physical NIC 803.

[0160] The physical NIC 803 presents the virtual function 8033 to the virtual machine 802, which corresponds to the virtual network card driver 8022. The data path 8024 connects the virtual function 8033 at the physical NIC 803 and the virtual network card driver 8022 at the virtual machine 802. The physical NIC 803 can present more than one virtual function to the virtual machine 802, and / or can present additional virtual functions to additional virtual machines. In general, each virtual machine can directly access the assigned virtual function. For example, the virtual machine can use its virtual network card driver to pass network packets with the assigned virtual function at the physical NIC 803 without intervention from the host 801. Doing so can reduce processor usage and network latency. For example, the virtual machine 802 and the physical NIC 803 can use the virtual function 8033 and the virtual network card driver 8022 to communicate directly through the data path 8023.

[0161] In the embodiment of the present application, the physical NIC 803 may be PCIe hardware that complies with SRIOV. In practical applications, one or more of the virtual function 8033 or the physical function 8034 may include a PCIe function. However, it should be noted that the principles described herein may be applied to various hardware devices, and are not limited to devices that comply with SRIOV or PCIe devices.

[0162] In the embodiment of the present application, the host 801 includes a virtual switch 8011. The virtual switch 8011 is configured to inspect and manipulate network packets sent and received by any hosted virtual machine according to common rules / flows. For example, based on defined rules and flows, the virtual switch 8011 may allow packets, block packets, reroute packets, perform network address translation, or perform any other packet inspection / manipulation applicable to the networking technology and devices used.

[0163] The virtual switch 8011 includes the following modules: flow table delivery 8111, rule matching 8112, data path flow conversion 8113 and flow merging processing. Among them, the rule matching 8112 converts the rules supported by the virtual switch into the fifth flow, and sends the fifth flow to the data path flow conversion 8113. The data path flow conversion is used to unload the received fifth flow to the flow processing 8321 of the physical network card to determine the first rule set composed of the rules supported by the physical network card. The flow table delivery 8111 is used to determine the first flow required for processing the received data packet, and send the first flow to the data path flow conversion 8113. The data path flow conversion 8113 matches the rules included in the received first flow with the first rule set, determines the unsupported flow corresponding to the third rule, and sends the unsupported flow and the fourth flow associated with the unsupported flow to the flow merging processing 8114, and sends the first flow that is not sent to the flow merging processing 8114 to the flow processing 8321 of the physical network card 803. The stream merging process 8114 processes the unsupported stream and the fourth stream in the first stream set to obtain an intermediate stream, and sends the intermediate stream to the stream processing 8321 of the physical network card 803 .

[0164] In the present application embodiment, Figure 8B As shown, the virtual switch 8011 sends the supported rules to the rule match 8112, the rule match 8112 combines the rules supported by the virtual switch 8011 to obtain the fifth flow, and sends the fifth flow to the data path flow conversion 8113, the data path flow conversion 8113 sends the fifth flow to the physical network card 803, and receives the processing result of the fifth flow by the physical network card 803, wherein the processing result can represent the first rule set supported by the physical network card.

[0165] In the present application embodiment, Figure 8C As shown, the flow table sending 8111 sends the first flow required for processing the received data packet to the data path flow conversion 8113, the data path flow conversion 8113 sends the unsupported flow that the physical network card does not support and the fourth flow that does not support flow dependency to the flow merging processing 8114, and directly sends the remaining first flow, i.e., the third flow, to the physical network card 803. The flow merging processing 8114 performs secondary processing on the received flow to obtain the intermediate flow, and sends the intermediate flow to the physical network card 803.

[0166] A rule defines a packet flow policy based on one or more rule conditions and one or more rule actions. In some embodiments, the rules vary depending on the specific virtual machine. The rules may be defined by an administrator, or may be defined by a higher level system. In some embodiments, the rules are static or relatively static. In some embodiments, the rules are stored in a rule set and configured for linear matching.

[0167] Rule conditions can be defined using tuples, which include fields and matching values, and tuples can be located in the header information (header domain) matched by the data packet. Tuples can include any combination of fields suitable for the network protocol and hardware device used. Tuples can include, for example, source and / or destination network addresses (e.g., IP addresses when IP is used), source and / or destination ports, protocols (e.g., TCP, UDP), source and / or destination hardware addresses (e.g., Ethernet MAC addresses) or combinations thereof. For example, exemplary rule conditions can be defined according to five tuples, such as '192.168.0.*,*,*,*,TCP', which will match any network packets on the 192.168.0.* network with any source IP address, any source port, any destination IP address, any destination port, and using the TCP protocol. In some embodiments, tuples can be related not only to flows, but also to packet conditions. For example, tuples can include fields related to IP service types (ToS). Those skilled in the art will appreciate that other tuples are also possible, including tuples related to networking technologies that have not yet been developed.

[0168] Rule actions, i.e., actions, may include any appropriate packet routing and / or manipulation operations. For example, some exemplary rule actions may include deny, allow, NAT, map, meter, decapsulate, encapsulate, etc. Those skilled in the art will appreciate that various other rule actions are possible, including actions related to networking technologies that have not yet been developed.

[0169] Rules can be used to define a rich set of packet processing policies. For example, using rule conditions (tuples) and rule actions, a rule can specify that UDP packets from a specific IP address are allowed. In another example, a rule can specify that TCP packets sent to any destination with a specified port are subject to NAT. Combining the above exemplary five-tuple example with an "allow" action, an exemplary rule can be defined as 'allow192.168.0.*,*,*,*,TCP', meaning that any network packet on the 192.168.0.* network with any source IP address, any source port, any destination IP address, any destination port, and using the TCP protocol should be allowed.

[0170] Stream is a dynamic state created based on rules. For example, when a network packet matches a rule, a stream can be created based on the rule. In this way, similar to a rule, a stream can also be defined according to conditions (tuples) and actions. Stream stores the context of a network connection and can be used to determine how to process the current packet in a stream or context based on a previous packet in the stream or context. In certain embodiments, a stream is stored in one or more stream tables, such as an incoming stream table and / or an outgoing stream table. For example, when a network packet matches an exemplary '192.168.0.*,*,*,*,TCP' rule, a corresponding stream can be created in one or more appropriate stream tables. In certain embodiments, a stream is indexed based on a tuple of a stream (e.g., using one or more hashes).

[0171] The flow unloading method provided in the embodiment of the present application is as follows: Fig. 9 As shown, including:

[0172] S901. Unload the rule set that needs to be uninstalled from the virtual switch to the physical network card.

[0173] When the virtual switch is started, the rule set A that needs to be uninstalled by the virtual switch is independently uninstalled to the physical network card in the form of streams;

[0174] S902. Determine the rules that the physical network card does not support according to the uninstallation result fed back by the physical network card.

[0175] According to the uninstallation result fed back by the physical network card, it is known that the physical network card supports the rule set B, and the rule set C that needs to be uninstalled in the virtual switch but is not supported in the physical network card is recorded, where:

[0176] S903: Perform secondary processing on the flow involved in the rule not supported by the physical network card to obtain the target flow.

[0177] After being processed by the data path flow conversion module, the flow is obtained, wherein the data path flow conversion module combines the required rules into a flow according to the packet header information of the data packet. For the flow involved in the unsupported rule, the flow merging processing module executes the action corresponding to the unsupported flow, performs flow merging processing, and obtains the flow after secondary processing.

[0178] In one example, suppose the virtual switch needs to uninstall 10 rules in total, and 100 flows can be used to cover all combinations of these rules and uninstall them to the physical network card; among them, the physical network card only supports flows composed of 9 rules, and one rule is not supported, such as modifying the TOS value of the IP header. At this time, there are 1 packet involving 5 rules and 60 flows, and there are 3 flows related to modifying the TOS value among these 60 flows. Then the flow merging processing module will process these 3 flows in the software and obtain the processing results, and the other flows will be uninstalled to the hardware network card for processing. In this way, we will have 57 flows uninstalled and 3 flows not uninstalled; with today's technology, all 60 flows will be sent to the hardware, because the hardware does not support a certain rule, and all will be sent to the host for software processing, resulting in all 60 flows cannot be uninstalled.

[0179] S904: Unload the secondary processed stream to the physical network card.

[0180] The physical network card completes the calculation process of subsequent flows.

[0181] The group processing method provided in the embodiment of the present application has the following technical features:

[0182] 1. Add a rule matching module to the virtual switch. When the virtual switch is started, the rule set supported by the virtual switch is unloaded to the physical network card in the form of streams;

[0183] 2. According to the uninstallation results fed back by the physical network card, record the rule sets that need to be uninstalled in the virtual switch but are not supported by the physical network card;

[0184] 3. Add a flow merging processing module in the virtual switch. For unsupported rules and involved flows, perform logical processing and secondary merging of flows in the flow merging processing module to obtain the secondary processed flow, thereby unloading the secondary processed flow to the physical network card, and the physical network card completes the subsequent process.

[0185] The group processing method provided in the embodiment of the present application includes the following technical effects:

[0186] 1. When changing the rule set of a virtual switch, it can avoid the situation where a large number of flows that use the rule and their related flows cannot be uninstalled because the new rule does not support uninstallation in the physical network card, thereby increasing the number of flows that can be uninstalled, reducing frequent kernel interactions and CPU burden, and improving the performance of the virtual network;

[0187] 2. When the virtual switch needs to adapt to smart network cards of different brands and models, it can avoid the need to re-adapt the rule set, and the same version of the virtual switch can support multiple different smart network cards, avoiding product fragmentation and reducing operation and maintenance complexity.

[0188] The embodiment of the present application provides a stream processing device 1000, which is applied to a host of an electronic device, wherein the electronic device also includes a physical network card, such as Fig.10 As shown, the device 1000 includes:

[0189] A first determining module 1001 is used to determine a first flow required for processing a first data packet, wherein the first flow constitutes a first flow set; the first flow includes at least one rule required for processing the first data packet;

[0190] A search module 1002 is used to search for a second flow from the first flow set according to a first rule set; the second flow constitutes a second flow set; the first rule in the first rule set is a rule supported by the physical network card;

[0191] A processing module 1003 is used to process the second stream to obtain an intermediate stream;

[0192] The sending module 1004 is used to send the intermediate flow and the third flow to the physical network card of the electronic device; the third flow is the flow in the first flow set except the second flow.

[0193] In some embodiments, the first determining module 1001 is further configured to:

[0194] Determine a second rule set according to the header information of the first data packet and the action information required when the first data packet is processed; the second rule set is composed of rules required to process the first data packet;

[0195] The rules with association relationships in the second rule set are combined to obtain a first flow constituting the first flow set.

[0196] In some embodiments, the search module 1002 is further configured to:

[0197] The searching the second flow set from the first flow set according to the first rule set includes:

[0198] Matching the rules included in each first flow in the first flow set with the first rule set to determine a third rule; the third rule is a rule included in the first flow but not included in the first rule set;

[0199] Determine that the first flow including the third rule is an unsupported flow; the unsupported flow is a flow that is not supported by the physical network card;

[0200] The second stream set is determined according to the unsupported streams.

[0201] In some embodiments, the search module 1002 is further configured to:

[0202] Searching, from the first set of flows, a fourth flow having a dependency relationship with the unsupported flow;

[0203] In a case where the first stream set includes the fourth stream, forming the second stream set based on the unsupported stream and the fourth stream;

[0204] In a case where the first stream set does not include the fourth stream, the second stream set is constructed based on the unsupported stream.

[0205] In some embodiments, the sending module 1004 is further used to:

[0206] determining a third flow in the first set of flows that has not been processed;

[0207] Based on the third stream and the intermediate stream, forming a third stream set;

[0208] The third flow set is sent to the physical network card.

[0209] In some embodiments, the apparatus 1000 further includes: a second determining module, configured to:

[0210] Acquire fourth rules supported by the virtual switch of the host to form a fourth rule set;

[0211] Combining the fourth rules in the fourth rule set to obtain a fifth flow; one of the fifth flows includes at least one of the fourth rules;

[0212] Sending the fifth stream to the physical network card, so that the physical network card processes the fifth stream and feeds back the processing result to the host;

[0213] The first rule set is determined according to the processing result.

[0214] An electronic device according to an embodiment of the present application, such as Figure 2 As shown in FIG. 7 , it includes: a host 201 and a physical network card 202; the first flow includes at least one rule required for processing the first data packet;

[0215] A host 201, configured to determine a first flow required for processing a first data packet, wherein the first flow constitutes a first flow set;

[0216] The host 201 is used to search for a second flow from the first flow set according to a first rule set; the second flow constitutes a second flow set; the first rule in the first rule set is a rule supported by the physical network card;

[0217] The host 201 is used to process the second stream to obtain an intermediate stream;

[0218] The host 201 is used to send the intermediate flow and the third flow to the physical network card 202; the third flow is the flow in the first flow set except the second flow.

[0219] In some embodiments, the host 201 is further configured to:

[0220] Determine a second rule set according to the header information of the first data packet and the action information required when the first data packet is processed; the second rule set is composed of rules required to process the first data packet; the action information represents the action when processing the first data packet;

[0221] The rules with association relationships in the second rule set are combined to obtain a first flow constituting the first flow set.

[0222] In some embodiments, the host 201 is further configured to:

[0223] Matching the rules included in each first flow in the first flow set with the first rule set to determine a third rule; the third rule is a rule included in the first flow but not included in the first rule set;

[0224] Determine that the first flow including the third rule is an unsupported flow; the unsupported flow is a flow that is not supported by the physical network card;

[0225] The second stream set is determined according to the unsupported streams.

[0226] In some embodiments, the host 201 is further configured to:

[0227] Searching, from the first set of flows, a fourth flow having a dependency relationship with the unsupported flow;

[0228] In a case where the first stream set includes the fourth stream, forming the second stream set based on the unsupported stream and the fourth stream;

[0229] In a case where the first stream set does not include the fourth stream, the second stream set is constructed based on the unsupported stream.

[0230] In some embodiments, the host 201 is further configured to:

[0231] determining a third flow in the first set of flows that has not been processed;

[0232] Based on the third stream and the intermediate stream, forming a third stream set;

[0233] The third flow set is sent to the physical network card 202.

[0234] In some embodiments, the physical network card 202 is further configured to process a third flow in the third flow set upon receiving a second data packet associated with the first data packet.

[0235] In some embodiments, the physical network card 202 is further used to:

[0236] After the host sends the intermediate stream and the third stream to the physical network card of the electronic device, receiving a new data packet;

[0237] Acquire the packet header information of the new data packet, and compare the packet header information of the new data packet with the packet header information of the first data packet;

[0238] In a case where the header information of the new data packet matches the header information of the first data packet, the physical network card determines that the second data packet is received.

[0239] In some embodiments,

[0240] The host 201 is further used to obtain a fourth rule supported by the virtual switch of the host to form a fourth rule set;

[0241] The host 201 is further configured to combine the fourth rules in the fourth rule set to obtain a fifth flow; one of the fifth flows includes at least one of the fourth rules;

[0242] The physical network card 202 is further configured to send the fifth flow to the physical network card, so that the physical network card processes the fifth flow and feeds back the processing result to the host;

[0243] The host 201 is further configured to determine the first rule set according to the processing result.

[0244] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0245] It should be noted that in the embodiment of the present application, if the above-mentioned unloading method of the flow is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.

[0246] Correspondingly, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the steps in the flow unloading method provided in the above embodiment are implemented.

[0247] Correspondingly, an embodiment of the present application provides a storage medium, that is, a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for unloading a stream provided in the above embodiment is implemented.

[0248] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0249] It should be noted that Fig.11 A hardware entity diagram of an electronic device according to an embodiment of the present application is shown in FIG. Fig.11 As shown, the electronic device 1100 includes: a processor 1101, at least one communication bus 1102, a user interface 1103, at least one external communication interface 1104 and a memory 1105. The communication bus 1102 is configured to achieve connection and communication between these components. The user interface 1103 may include a display screen, and the external communication interface 1104 may include a standard wired interface and a wireless interface.

[0250] The memory 1105 is configured to store instructions and applications executable by the processor 1101, and can also cache data to be processed or processed by the processor 1101 and various modules in the electronic device (for example, image data, audio data, voice communication data, and video communication data), which can be implemented through flash memory (FLASH) or random access memory (Random Access Memory, RAM).

[0251] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.

[0252] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0253] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0254] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0255] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0256] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.

[0257] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0258] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for unloading a stream, characterized in that: A host applied to an electronic device, wherein the electronic device further includes a physical network card, and the method includes: Determine a first flow required for processing a first data packet, the first flow constituting a first flow set; the first flow includes at least one rule required for processing the first data packet; According to the first rule set, searching for a second flow from the first flow set; the second flow constitutes a second flow set, the second flow is a flow related to a rule not supported by the physical network card; the first rule in the first rule set is a rule supported by the physical network card; processing the second stream to obtain an intermediate stream; The intermediate flow and the third flow are sent to the physical network card of the electronic device; the third flow is a flow in the first flow set except the second flow.

2. The method according to claim 1, characterized in that The determining of a first flow required for processing a first data packet comprises: Determine a second rule set according to the header information of the first data packet and the action information required when the first data packet is processed; the second rule set is composed of rules required to process the first data packet; The rules with association relationships in the second rule set are combined to obtain a first flow constituting the first flow set.

3. The method according to claim 1, characterized in that The searching the second flow set from the first flow set according to the first rule set includes: Matching the rules included in each first flow in the first flow set with the first rule set to determine a third rule; the third rule is a rule included in the first flow but not included in the first rule set; Determine that the first flow including the third rule is an unsupported flow; the unsupported flow is a flow that is not supported by the physical network card; The second stream set is determined according to the unsupported streams.

4. The method according to claim 3, characterized in that The determining the second stream set according to the unsupported stream comprises: Searching, from the first set of flows, a fourth flow having a dependency relationship with the unsupported flow; In a case where the first stream set includes the fourth stream, forming the second stream set based on the unsupported stream and the fourth stream; In a case where the first stream set does not include the fourth stream, the second stream set is constructed based on the unsupported stream.

5. The method according to claim 1, characterized in that: The sending the intermediate stream and the third stream to the physical network card comprises: determining a third flow in the first set of flows that has not been processed; Based on the third stream and the intermediate stream, forming a third stream set; The third flow set is sent to the physical network card.

6. The method according to claim 1, characterized in that The method further comprises: Acquire fourth rules supported by the virtual switch of the host to form a fourth rule set; Combining the fourth rules in the fourth rule set to obtain a fifth flow; one of the fifth flows includes at least one of the fourth rules; Sending the fifth stream to the physical network card, so that the physical network card processes the fifth stream and feeds back the processing result to the host; The first rule set is determined according to the processing result.

7. A method for processing a stream, characterized in that: Applied to an electronic device, the electronic device comprises: a host and a physical network card, the method comprises: The host determines a first flow required for processing a first data packet, the first flow constituting a first flow set; the first flow includes at least one rule required for processing the first data packet; The host searches for a second flow from the first flow set according to the first rule set; the second flow constitutes a second flow set, and the second flow is a flow related to a rule not supported by the physical network card; the first rule in the first rule set is a rule supported by the physical network card; The host processes the second stream to obtain an intermediate stream; The host sends the intermediate flow and the third flow to the physical network card of the electronic device; the third flow is a flow in the first flow set except the second flow; the intermediate flow and the third flow constitute a third flow set; The physical network card processes the flows in the third flow set when receiving the second data packet associated with the first data packet.

8. The method according to claim 7, characterized in that After the host sends the intermediate stream and the third stream to the physical network card of the electronic device, the method further includes: The physical network card receives a new data packet; The physical network card obtains the header information of the new data packet, and compares the header information of the new data packet with the header information of the first data packet; When the header information of the new data packet matches the header information of the first data packet, the physical network card determines that the second data packet is received.

9. A stream processing device, characterized in that: A host applied to an electronic device, wherein the electronic device further includes a physical network card, and the device includes: A first determining module, configured to determine a first flow required for processing a first data packet, wherein the first flow constitutes a first flow set; the first flow includes at least one rule required for processing the first data packet; A search module, configured to search for a second flow from the first flow set according to a first rule set; the second flow constitutes a second flow set, the second flow is a flow related to a rule not supported by the physical network card; the first rule in the first rule set is a rule supported by the physical network card; A processing module, used for processing the second stream to obtain an intermediate stream; The sending module is used to send the intermediate flow and the third flow to the physical network card of the electronic device; the third flow is the flow in the first flow set except the second flow.

10. An electronic device, comprising a host and a physical network card, wherein the host comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps in the method for unloading a stream according to any one of claims 1 to 6 are implemented.