Data processing method and device, equipment, storage medium and program product
By generating optimized hardware forwarding flow tables through modulo operations on RSS values, the method addresses flow table bottlenecks in virtual machine networks, ensuring efficient data packet forwarding.
Patent Information
- Application Number
- CN202411074433.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-31
AI Technical Summary
The generation of a large number of flow tables between virtual machines with multiple service ports leads to bottlenecks in data packet forwarding performance due to full interconnection in network elements, affecting forwarding efficiency.
Implement a data processing method that generates first- and second-level hardware forwarding flow tables using a modulo operation on the receive side scaling (RSS) value, reducing the need for individual flow tables between each port pair by utilizing a smart network card and virtual switch control plane to optimize flow table configuration.
This approach reduces the number of flow tables required, preventing bottlenecks and maintaining data packet forwarding performance by evenly distributing traffic across multiple ports using fewer hardware forwarding flow tables.
Smart Images

Figure CN119225901A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of network communication technology, and in particular, relates to a data processing method, device, equipment, storage medium and program product. Background Art
[0002] The virtual machine (VM) in the network element can be configured with multiple service ports. When two virtual machines are configured with multiple service ports, the packet sending process between the two virtual machines will generate a large number of flow tables; for example, VM1 and VM2 represent two different virtual machines, VM1 has N ports, VM2 has M ports, N and M are both integers greater than 1, at this time, the traffic sent from VM1 to VM2 will generate N*M flow tables, which is prone to bottlenecks in the flow table item specifications and thus affect the data packet forwarding performance. Summary of the invention
[0003] Embodiments of the present application provide a data processing method, apparatus, device, storage medium, and program product.
[0004] The present application provides a data processing method, which is applied to a control plane of a virtual switch. The method includes:
[0005] Obtaining a first data packet and a receive side scaling (RSS) value of the first data packet, wherein the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card;
[0006] Generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, wherein the first-level hardware forwarding flow table includes at least a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table includes at least a modulo operation result obtained according to the first action and a second action of processing the first data packet.
[0007] In some embodiments, the generating of the first-level hardware forwarding flow table and the second-level hardware forwarding flow table includes: according to the first data packet and the RSS value, using the datapath hash (dp-hash) two-time matching method to generate the first-level hardware forwarding flow table and the second-level hardware forwarding flow table.
[0008] In some embodiments, the action in the first-level hardware forwarding flow table includes the identifier of the first action and the second-level hardware forwarding flow table; the key in the second-level hardware forwarding flow table includes its own identifier and the modulo operation result obtained according to the first action, and the action in the second-level hardware forwarding flow table includes the second action.
[0009] In some embodiments, obtaining the first data packet and the RSS value of the first data packet includes: receiving the first data packet sent by the smart network card and the RSS value of the first data packet generated by the smart network card, the first data packet and the RSS value are sent by the smart network card when it is determined that there is no hardware forwarding flow table matching the first data packet.
[0010] It can be seen that when the smart network card determines that there is no hardware forwarding flow table matching the first data packet, the control plane of the virtual switch can generate the first hardware forwarding flow table and the second hardware forwarding flow table by sending the first data packet and the RSS value of the first data packet, thereby facilitating the forwarding of data packets according to the first hardware forwarding flow table and the second hardware forwarding flow table.
[0011] In some embodiments, after generating a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, the method further includes: sending the first-level hardware forwarding flow table and the second-level hardware forwarding flow table to the smart network card, and after processing the first data packet according to the second action, re-injecting the processed first data packet into the smart network card, so that the smart network card sends the processed first data packet to the second virtual machine.
[0012] The embodiment of the present application also provides another data processing method, which is applied to a smart network card, and the method includes:
[0013] Receive a first data packet, where the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card;
[0014] When it is determined that there is no hardware forwarding flow table matching the first data packet, sending the first data packet and the RSS value of the first data packet to the control plane of the virtual switch;
[0015] Receive a first-level hardware forwarding flow table and a second-level hardware forwarding flow table issued by the control plane of the virtual switch; the virtual switch control plane is used to generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet.
[0016] In some embodiments, the method also includes: when receiving the first-level hardware forwarding flow table and the second-level hardware forwarding flow table issued by the control plane of the virtual switch, receiving the processed first data packet; the control plane of the virtual switch is also used to process the first data packet according to the second action to obtain the processed first data packet; and sending the processed first data packet to the second virtual machine.
[0017] It can be seen that when the smart network card determines that there is no hardware forwarding flow table matching the first data packet, the control plane of the virtual switch can generate the first hardware forwarding flow table and the second hardware forwarding flow table by sending the first data packet and the RSS value of the first data packet, which is conducive to realizing the forwarding of the data packet according to the first hardware forwarding flow table and the second hardware forwarding flow table; at the same time, by sending the first data packet and the RSS value of the first data packet, the control plane of the virtual switch can obtain the processed first data packet, so that the forwarding of the first data packet can be realized on the smart network card.
[0018] In some embodiments, the action in the first-level hardware forwarding flow table includes the identifier of the first action and the second-level hardware forwarding flow table; the key in the second-level hardware forwarding flow table includes its own identifier and the modulo operation result obtained according to the first action, and the action in the second-level hardware forwarding flow table includes the second action.
[0019] In some embodiments, the action in the second-level hardware forwarding flow table includes its own identification and the result of the modulo operation obtained according to the first action. After receiving the first data packet, the method further includes: when it is determined that there is a hardware forwarding flow table that matches the first data packet triple, according to the action in the first-level hardware forwarding flow table that matches the first data packet triple, the modulo operation result of the RSS value of the first data packet and the identification of the second-level hardware forwarding flow table are obtained; the first data packet triple includes a source Internet Protocol (Internet Protocol, IP) address, a destination IP address and a protocol number; according to the modulo operation result and the identification of the second-level hardware forwarding flow table, the second-level hardware forwarding flow table is searched; according to the action in the second-level hardware forwarding flow table found, the first data packet is processed to obtain a processed first data packet; and the processed first data packet is sent to the second virtual machine.
[0020] The present application also provides a data processing device, which is applied to a control plane of a virtual switch, and the device includes:
[0021] An acquisition module, configured to acquire a first data packet and a receiving end adjustment value RSS value of the first data packet, wherein the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card;
[0022] The first processing module is used to generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, wherein the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet.
[0023] The embodiment of the present application also provides another data processing device, which is applied to a smart network card, and the device includes:
[0024] A receiving module, configured to receive a first data packet, where the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card;
[0025] a sending module, configured to send the first data packet and the RSS value of the first data packet to a control plane of the virtual switch when it is determined that there is no hardware forwarding flow table matching the first data packet;
[0026] A second processing module is used to receive a first-level hardware forwarding flow table and a second-level hardware forwarding flow table issued by the control plane of the virtual switch; the control plane of the virtual switch is used to generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet;
[0027] The sending module is further used to send the processed first data packet to the second virtual machine.
[0028] An embodiment of the present application also provides an electronic device, comprising a processor and a memory for storing a computer program that can be run on the processor; wherein the processor is used to run the computer program to execute any one of the above-mentioned data processing methods.
[0029] An embodiment of the present application further provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned data processing methods is implemented.
[0030] An embodiment of the present application further provides a computer program product, including a computer program, which implements any of the above-mentioned data processing methods when executed by a processor.
[0031] It can be seen that the embodiment of the present application does not need to set up flow tables for the paths between each port of the first virtual machine and each port of the second virtual machine. When only the first-level hardware forwarding flow table and the second-level hardware forwarding flow table are set, the smart network card can complete the forwarding of data packets according to the first-level hardware forwarding flow table and the second-level hardware forwarding flow table; therefore, compared with the solution in the related art that flow tables are set up for the paths between each port of the first virtual machine and each port of the second virtual machine, the embodiment of the present application can achieve data forwarding by setting fewer hardware forwarding flow tables, so that the flow table item specifications are not prone to bottlenecks, which is conducive to maintaining data packet forwarding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A schematic diagram of a simplified form of a flow table proposed for the related art;
[0033] Figure 2 This is a flow chart of a data processing method applied to a control plane of a virtual switch according to an embodiment of the present application;
[0034] Figure 3 A schematic diagram of selecting a CPU core using a hash function operation proposed in an embodiment of the present application;
[0035] Figure 4 A schematic diagram of a simplified secondary flow table proposed in an embodiment of the present application;
[0036] Figure 5 This is a flow chart of a data processing method applied to a smart network card according to an embodiment of the present application;
[0037] Figure 6 This is a flow chart of the interaction between the smart network card and the control plane of the virtual machine switch in the embodiment of the present application;
[0038] Figure 7 This is a schematic diagram of the structure of a data processing device applied to a control plane of a virtual switch according to an embodiment of the present application;
[0039] Figure 8 This is a structural diagram of a data processing device applied to a smart network card according to an embodiment of the present application;
[0040] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] In the related art, the core network elements have a fully interconnected feature, which is manifested in that the inside of the network element is almost fully interconnected to achieve service takeover between VMs, and the network elements are fully interconnected to achieve full network connectivity. In this context, if a smart network card is used to implement the forwarding plane function of a virtual switch (vSwitch), the smart network card uses a keyword (KEY) with a five-tuple of packet information (protocol number, source IP address, destination IP address, source port number, destination port number) as a matching item to achieve forwarding. When a VM in a network element is configured with multiple service ports, a massive flow table will be generated. Exemplarily, VM1 and VM2 represent two different VMs, VM1 has N ports, VM2 has M ports, N and M are both integers greater than 1, at this time, the traffic sent from VM1 to VM2 will generate N*M flow tables, Figure 1 It is a simplified form of N*M flow tables, where src_ip(IP1) represents the source IP address, dst_ip(IP2) represents the destination IP address, proto(17) represents the protocol number, src_port(1) to src_port(N) represent N source port numbers, dstport(1) to dstport(M) represent M destination port numbers, VXLAN encap() represents the encapsulation processing for the data packet, and outport(bond_port) represents the physical network port for sending the data packet.
[0042] It can be seen that when a large number of flow tables are generated in the packet sending process between two VMs, due to the full interconnection between virtual machines, it is easy for the flow table item specifications of a single server node (the node used to process data forwarding of the virtual machine) to become a bottleneck, thereby affecting the forwarding performance.
[0043] In order to solve the above technical problems, a technical solution of the embodiment of the present application is proposed.
[0044] The following is a further detailed description of the embodiments of the present application in conjunction with the accompanying drawings and examples. It should be understood that the embodiments provided herein are only used to explain the embodiments of the present application and are not intended to limit the embodiments of the present application. In addition, the embodiments provided below are partial embodiments for implementing the present application, rather than providing all embodiments for implementing the present application. In the absence of conflict, the technical solutions recorded in the embodiments of the present application can be implemented in any combination.
[0045] It should be noted that, in the embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or device including a series of elements includes not only the elements explicitly recorded, but also includes other elements not explicitly listed, or also includes elements inherent to the implementation of the method or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other related elements (such as steps in a method or units in a device, for example, a unit may be a part of a circuit, a part of a processor, a part of a program or software, etc.) in the method or device including the element.
[0046] The data processing method provided in the embodiment of the present application includes a series of steps, but the data processing method provided in the embodiment of the present application is not limited to the recorded steps. Similarly, the data processing device provided in the embodiment of the present application includes a series of modules, but the device provided in the embodiment of the present application is not limited to including the modules explicitly recorded, and may also include modules required to obtain relevant information or perform processing based on information.
[0047] Figure 2 Flow chart of a data processing method for a control plane of a virtual switch according to an embodiment of the present application. Figure 2 As shown, the process may include:
[0048] Step 201: Obtain a first data packet and an RSS value of the first data packet, where the first data packet is a data packet sent by a first virtual machine to a second virtual machine through a smart network card.
[0049] In some embodiments, the process of obtaining a first data packet and an RSS value of the first data packet may include: receiving a first data packet sent by a smart network card and an RSS value of the first data packet generated by the smart network card, the first data packet and the above RSS value are sent by the smart network card when it is determined that there is no hardware forwarding flow table matching the first data packet.
[0050] In an embodiment of the present application, after receiving the first data packet, the smart network card can perform a table lookup operation to determine whether there is a hardware forwarding flow table that matches the first data packet; if it is determined that there is no hardware forwarding flow table that matches the first data packet, the RSS value of the first data packet can be calculated, and then the first data packet and the RSS value of the first data packet can be sent up to the control plane of the virtual switch. RSS is a network card driver method that can efficiently distribute received messages among multiple CPUs in a multi-processor system. When using the RSS method, the smart network card can parse the message, calculate the hash value, and use the characteristics of the hash to select a central processing unit (CPU) core and send the data packet to the CPU core for processing. Reference Figure 3 , an input data packet of any length can be transformed into data of fixed length through a hash function. The output data is a hash value (i.e., a hash value). After the hash value is operated through a hash mask, a hash index can be generated. The hash index can be used as an array index to find the CPU core that needs to process the data packet in the indirection table. For example, the CPU core to be found can be Figure 3 CPU n in; see Figure 3 , and the RSS performance can also be improved by using the Message Signaled Interrupt (MSI). In order to prevent multiple inputs from indexing the same data, such hash conflicts are avoided as much as possible when designing the hash function.
[0051] Step 202: Generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet.
[0052] It can be seen that when the smart network card determines that there is no hardware forwarding flow table matching the first data packet, the control plane of the virtual switch can generate the first hardware forwarding flow table and the second hardware forwarding flow table by sending the first data packet and the RSS value of the first data packet, thereby facilitating the forwarding of data packets according to the first hardware forwarding flow table and the second hardware forwarding flow table.
[0053] In some embodiments, the number of port numbers of the second virtual machine can be obtained according to the equal-cost multi-path routing (ECMP) configuration issued by the software defined network controller (Software Defined Network Controller, SDNC), or can be obtained by other methods, which is not limited in the embodiments of the present application.
[0054] In some embodiments, the process of generating a first-level hardware forwarding flow table and a second-level hardware forwarding flow table includes: generating a first-level hardware forwarding flow table and a second-level hardware forwarding flow table by using a dp-hash double matching method based on a first data packet and an RSS value.
[0055] The dp-hash operation can be understood as a packet-by-packet hash operation, and a bucket can be selected based on the result of the packet hash operation. When implementing the dp-hash operation, a first match is performed for each packet, and the action used in the first match is to calculate the hash value; then a second match is performed on the packet, and the hash value is used as the key to find the corresponding action.
[0056] In some embodiments, the action in the first-level hardware forwarding flow table includes the first action and the identifier of the second-level hardware forwarding flow table; the key in the second-level hardware forwarding flow table includes its own identifier and the modulo operation result obtained according to the first action, and the action in the second-level hardware forwarding flow table includes the second action.
[0057] Exemplarily, the identifier of the second-level hardware forwarding flow table can be an identity document (ID) or other identifier, and the key in the first-level hardware forwarding flow table includes the protocol number, source IP address and destination IP address, but does not include the source port number and destination port number. Figure 4 Schematic diagram of a simplified form of the first-level hardware forwarding flow table and the second-level hardware forwarding flow table, refer to Figure 4 There is one first-level hardware forwarding flow table. The keys in the first-level hardware forwarding flow table include src_ip(IP1), dst_ip(IP2) and proto(17). The actions in the first-level hardware forwarding flow table include dp-hash mod(RSS, M) and recric(m). Here, the meanings of src_ip(IP1), dst_ip(IP2) and proto(17) are already in the description of Figure 1It is explained in the description that dp-hash mod(RSS, M) represents the first action of performing a modulo operation on the RSS value according to the number of ports M of the second virtual machine, and the operation result of dp-hash mod(RSS, M) is 0 to M-1; recric(m) represents the ID of the mth flow table in the second-level hardware forwarding flow table, and the value of m is 1 to M.
[0058] Reference Figure 4 The second-level hardware forwarding flow table includes flow table 1 to flow table M. The key of each flow table in the second-level hardware forwarding flow table includes the ID of the flow table and the modulo operation result obtained according to the first action. Figure 4 In the example, recric(1) to recric(M) represent the IDs of flow tables 1 to M respectively. The modulo operation result obtained according to the first action can be 0 to M-1. The action of each flow table in the second-level hardware forwarding flow table includes VXLAN encap() and outport(bond_port). The meanings of VXLAN encap() and outport(bond_port) have been described in the section about Figure 1 Please explain in the description.
[0059] It can be seen that when the first-level hardware forwarding flow table and the second-level hardware forwarding flow table are sent to the smart network card, if the smart network card receives a data packet subsequently, it can first determine the modulo operation result and the identifier of the second-level hardware forwarding flow table using the action in the first-level hardware forwarding flow table, so that the second-level hardware forwarding flow table can be found according to the modulo operation result and the identifier of the second-level hardware forwarding flow table, which is conducive to performing corresponding data packet processing and forwarding operations according to the found second-level hardware forwarding flow table.
[0060] In some embodiments, after generating the first-level hardware forwarding flow table and the second-level hardware forwarding flow table, the first-level hardware forwarding flow table and the second-level hardware forwarding flow table can also be sent to the smart network card, and after processing the first data packet according to the second action, the processed first data packet is reinjected into the smart network card, so that the smart network card sends the processed first data packet to the second virtual machine.
[0061] In practical applications, steps 201 to 202 can be implemented based on a processor, and the processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a CPU, a controller, a microcontroller, and a microprocessor.
[0062] It can be seen that the embodiment of the present application does not need to set up flow tables for the paths between each port of the first virtual machine and each port of the second virtual machine. When only the first-level hardware forwarding flow table and the second-level hardware forwarding flow table are set, the smart network card can complete the forwarding of data packets according to the first-level hardware forwarding flow table and the second-level hardware forwarding flow table; therefore, compared with the solution in the related art that flow tables are set up for the paths between each port of the first virtual machine and each port of the second virtual machine, the embodiment of the present application can achieve data forwarding by setting fewer hardware forwarding flow tables, so that the flow table item specifications are not prone to bottlenecks, which is conducive to maintaining data packet forwarding performance.
[0063] Exemplarily, VM1 and VM2 represent two different virtual machines, VM1 has N ports, VM2 has M ports, N and M are both integers greater than 1, at this time, if the technical solution of the related technology is adopted, the traffic sent from VM1 to VM2 will generate N*M flow tables; if the technical solution of the embodiment of the present application is adopted, a first-level hardware forwarding flow table can be set, and the number of second-level hardware forwarding flow tables can be the number of values of the result of the modulo operation. Obviously, the number of values of the result of the modulo operation is M. Therefore, the embodiment of the present application can realize data packet forwarding by setting a first-level hardware forwarding flow table and M second-level hardware forwarding flow tables. The technical solution of the embodiment of the present application can reduce the number of hardware forwarding flow tables that need to be set. Since the value of the result of the modulo operation is usually a uniformly distributed value, when the technical solution of the embodiment of the present application is adopted for traffic forwarding, the traffic can be evenly distributed to multiple ports of the destination virtual machine.
[0064] Exemplarily, when the destination port of the second virtual machine changes, the first-level hardware forwarding flow table may remain unchanged, and data packet forwarding can be achieved by simply refreshing the second-level hardware forwarding flow table.
[0065] Figure 5Flow chart of the data processing method applied to the smart network card according to the embodiment of the present application. Figure 5 As shown, the process may include:
[0066] Step 501: Receive a first data packet, where the first data packet is a data packet sent by a first virtual machine to a second virtual machine through a smart network card.
[0067] Step 502: When it is determined that there is no hardware forwarding flow table matching the first data packet, the first data packet and the RSS value of the first data packet are sent to the control plane of the virtual switch.
[0068] Step 503: Receive the first-level hardware forwarding flow table and the second-level hardware forwarding flow table issued by the control plane of the virtual switch; the control plane of the virtual switch is used to generate the first-level hardware forwarding flow table and the second-level hardware forwarding flow table, the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet.
[0069] In some embodiments, when the smart network card receives the first-level hardware forwarding flow table and the second-level hardware forwarding flow table issued by the control plane of the virtual switch, it can also receive the processed first data packet; the control plane of the virtual switch is also used to process the first data packet according to the second action to obtain the processed first data packet; the smart network card can also send the processed first data packet to the second virtual machine.
[0070] In practical applications, steps 501 to 503 may be implemented based on a processor, and the processor may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.
[0071] It can be seen that the embodiment of the present application does not need to set up flow tables for the paths between each port of the first virtual machine and each port of the second virtual machine. When only the first-level hardware forwarding flow table and the second-level hardware forwarding flow table are set, the smart network card can complete the forwarding of data packets according to the first-level hardware forwarding flow table and the second-level hardware forwarding flow table; therefore, compared with the solution in the related art that flow tables are set up for the paths between each port of the first virtual machine and each port of the second virtual machine, the embodiment of the present application can achieve data forwarding by setting fewer hardware forwarding flow tables, so that bottlenecks are not likely to occur in the specifications of the flow table items, which is conducive to maintaining the data packet forwarding performance.
[0072] In some embodiments of the present application, the action in the first-level hardware forwarding flow table includes the first action and the identifier of the second-level hardware forwarding flow table; the key in the second-level hardware forwarding flow table includes its own identifier and the modulo operation result obtained according to the first action, and the action in the second-level hardware forwarding flow table includes the second action.
[0073] In some embodiments of the present application, the action in the second-level hardware forwarding flow table includes its own identifier and a modulo operation result obtained according to the first action.
[0074] After receiving the first data packet, the smart network card may further perform the following steps:
[0075] When it is determined that there is a hardware forwarding flow table matching the first data packet triplet, a modulo operation result of the RSS value of the first data packet and an identifier of the second-level hardware forwarding flow table are obtained according to the action in the first-level hardware forwarding flow table matching the first data packet triplet; the first data packet triplet includes a source IP address, a destination IP address and a protocol number;
[0076] According to the modulo operation result and the identifier of the second-level hardware forwarding flow table, searching the second-level hardware forwarding flow table;
[0077] Processing the first data packet according to the action in the found second-level hardware forwarding flow table to obtain a processed first data packet;
[0078] The processed first data packet is sent to the second virtual machine.
[0079] Here, since the key in the first-level hardware forwarding flow table includes information such as the source IP address, the destination IP address and the protocol number, the intelligent network card can determine whether there is a first-level hardware forwarding flow table that matches the first data packet triplet; if there is a first-level hardware forwarding flow table that matches the first data packet triplet, the action can be determined in the first-level hardware forwarding flow table that matches the first data packet triplet, and the modulo operation result of the RSS value of the first data packet and the identifier of the second-level hardware forwarding flow table are determined according to the information in the action, so that the corresponding second-level hardware forwarding flow table can be found according to the modulo operation result and the identifier of the second-level hardware forwarding flow table.
[0080] The action in the second-level hardware forwarding flow table includes the second action, so the smart network card can process the first data packet according to the second action to obtain the processed first data packet; exemplarily, the smart network card can complete the encapsulation and forwarding of the first data packet according to the action in the second-level hardware forwarding flow table.
[0081] Figure 6This is a flow chart of the interaction between the smart network card and the control plane of the virtual machine switch in the embodiment of the present application, such as Figure 6 As shown, after the smart network card receives the first data packet, it can determine whether there is a hardware forwarding flow table that matches the first data packet, and perform corresponding operations according to the judgment result. If it is determined that there is no hardware forwarding flow table that matches the first data packet (for example, when the first data packet is the data packet sent by the smart network card for the first time, there is no hardware forwarding flow table that matches the first data packet), the first data packet and the RSS value of the first data packet can be sent to the control plane of the virtual switch; the control plane of the virtual switch can receive the first data packet and the RSS value of the first data packet, and then can generate the first-level hardware forwarding flow table and the second-level hardware forwarding flow table by matching the control plane ECMP routing table item, and perform virtual eXtensible Local Area Network (vxlan) encapsulation on the first data packet; send the first-level hardware forwarding flow table and the second-level hardware forwarding flow table to the smart network card, so that the smart network card saves the corresponding flow table. The control plane of the virtual switch can also re-inject the processed first data packet into the smart network card, so that the smart network card selects the physical network port to send the data packet according to the action of the second-level hardware forwarding flow table, thereby completing the sending of the first data packet.
[0082] When the smart network card determines that there is a hardware forwarding flow table that matches the first data packet triplet, it can determine the corresponding second-level hardware forwarding flow table based on the first-level hardware forwarding flow table that matches the first data packet triplet, complete the encapsulation of the first data packet according to the action of the second-level hardware forwarding flow table, and then select the physical network port for sending the data packet according to the action of the second-level hardware forwarding flow table, thereby completing the sending of the first data packet.
[0083] In summary, the embodiments of the present application can utilize the RSS function of the network card hardware and cooperate with the dp-hash function of the virtual switch to optimize the flow table configuration, which can reduce the number of flow tables generated by distributed routing traffic to a certain extent and improve the forwarding performance of data packets in the network.
[0084] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0085] Figure 7 Schematic diagram of the structure of a data processing device applied to a control plane of a virtual switch according to an embodiment of the present application. Figure 7 As shown, the device comprises:
[0086] An acquisition module 701 is configured to acquire a first data packet and a receiving end adjustment value RSS value of the first data packet, wherein the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card;
[0087] The first processing module 702 is used to generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, wherein the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet.
[0088] In some embodiments, the first processing module 702 is used to generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, including: according to the first data packet and the RSS value, using the data path hash dp-hash twice matching method to generate the first-level hardware forwarding flow table and the second-level hardware forwarding flow table.
[0089] In some embodiments, the action action in the first-level hardware forwarding flow table includes the identifier of the first action and the second-level hardware forwarding flow table; the keyword key in the second-level hardware forwarding flow table includes its own identifier and the modulo operation result obtained according to the first action, and the action in the second-level hardware forwarding flow table includes the second action.
[0090] In some embodiments, the acquisition module 701 is used to acquire the first data packet and the RSS value of the first data packet, including:
[0091] A first data packet sent by the smart network card and an RSS value of the first data packet generated by the smart network card are received, where the first data packet and the RSS value are sent by the smart network card when it is determined that there is no hardware forwarding flow table matching the first data packet.
[0092] In some embodiments, the first processing module 702 is also used to send the first-level hardware forwarding flow table and the second-level hardware forwarding flow table to the smart network card after generating the first-level hardware forwarding flow table, and after processing the first data packet according to the second action, re-inject the processed first data packet into the smart network card, so that the smart network card sends the processed first data packet to the second virtual machine.
[0093] In practical applications, the acquisition module 701 and the first processing module 702 can be implemented based on a processor and a communication device.
[0094] Figure 8Schematic diagram of the structure of the data processing device applied to the smart network card according to the embodiment of the present application. Figure 8 As shown, the device comprises:
[0095] The receiving module 801 is used to receive a first data packet, where the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card;
[0096] A sending module 802, configured to send the first data packet and the RSS value of the first data packet to a control plane of the virtual switch when it is determined that there is no hardware forwarding flow table matching the first data packet;
[0097] The second processing module 803 is used to receive the first-level hardware forwarding flow table and the second-level hardware forwarding flow table issued by the control plane of the virtual switch; the control plane of the virtual switch is used to generate the first-level hardware forwarding flow table and the second-level hardware forwarding flow table, the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet;
[0098] The sending module 802 is further configured to send the processed first data packet to the second virtual machine.
[0099] In some embodiments, the second processing module 803 is further used to receive the processed first data packet when receiving the first-level hardware forwarding flow table and the second-level hardware forwarding flow table issued by the control plane of the virtual switch; the control plane of the virtual switch is further used to process the first data packet according to the second action to obtain the processed first data packet;
[0100] The second processing module 803 is further configured to send the processed first data packet to the second virtual machine.
[0101] In some embodiments, the action in the first-level hardware forwarding flow table includes the identifier of the first action and the second-level hardware forwarding flow table; the key in the second-level hardware forwarding flow table includes its own identifier and the modulo operation result obtained according to the first action, and the action in the second-level hardware forwarding flow table includes the second action.
[0102] In some embodiments, the action in the second-level hardware forwarding flow table includes its own identifier and a modulo operation result obtained according to the first action.
[0103] The second processing module 803 is further configured to:
[0104] When it is determined that there is a hardware forwarding flow table that matches the first data packet triplet, a modulo operation result of the RSS value of the first data packet and an identifier of the second-level hardware forwarding flow table are obtained according to an action in the first-level hardware forwarding flow table that matches the first data packet triplet; the first data packet triplet includes a source IP address, a destination IP address and a protocol number;
[0105] Searching the second-level hardware forwarding flow table according to the modulo operation result and the identifier of the second-level hardware forwarding flow table;
[0106] Processing the first data packet according to the action in the second-level hardware forwarding flow table found to obtain a processed first data packet;
[0107] The processed first data packet is sent to the second virtual machine.
[0108] In practical applications, the receiving module 801, the sending module 802 and the second processing module 803 can be implemented based on a processor and a communication device.
[0109] It should be noted that 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.
[0110] It should be noted that in the embodiments of the present application, if the above method 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 prior art 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 terminal, a server, 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 embodiments of the present application are not limited to any specific combination of hardware and software.
[0111] Correspondingly, an embodiment of the present application further provides a computer program product, which includes computer executable instructions, and the computer executable instructions are used to implement any data processing method provided in the embodiment of the present application.
[0112] Accordingly, an embodiment of the present application further provides a computer storage medium, on which computer executable instructions are stored, and the computer executable instructions are used to implement any one of the data processing methods provided in the above embodiments.
[0113] An embodiment of the present application also provides an electronic device. Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the electronic device 90 may include:
[0114] Memory 901, used to store executable instructions;
[0115] The processor 902 is used to implement any of the above-mentioned data processing methods when executing the executable instructions stored in the memory 901.
[0116] The processor 902 may be at least one of an ASIC, a DSP, a DSPD, a PLD, a FPGA, a CPU, a controller, a microcontroller, and a microprocessor.
[0117] The above-mentioned computer-readable storage medium and memory 902 can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0118] In some embodiments, the functions or modules included in the device provided in the embodiments of the present application can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0119] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0120] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0121] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0122] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0123] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0124] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data processing method, characterized in that: Applied to the control plane of a virtual switch, the method comprises: Obtaining a first data packet and a receiving end adjustment value RSS value of the first data packet, wherein the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card; Generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, wherein the first-level hardware forwarding flow table includes at least a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table includes at least a modulo operation result obtained according to the first action and a second action of processing the first data packet.
2. The method according to claim 1, characterized in that The generating of the first level hardware forwarding flow table and the second level hardware forwarding flow table comprises: According to the first data packet and the RSS value, the first-level hardware forwarding flow table and the second-level hardware forwarding flow table are generated by using a data path hash dp-hash twice matching method.
3. The method according to claim 1, characterized in that The action action in the first-level hardware forwarding flow table includes the first action and the identifier of the second-level hardware forwarding flow table; The keyword key in the second-level hardware forwarding flow table includes its own identifier and a modulo operation result obtained according to the first action, and the action in the second-level hardware forwarding flow table includes the second action.
4. The method according to any one of claims 1 to 3, characterized in that: The obtaining of the first data packet and the RSS value of the first data packet includes: A first data packet sent by the smart network card and an RSS value of the first data packet generated by the smart network card are received, where the first data packet and the RSS value are sent by the smart network card when it is determined that there is no hardware forwarding flow table matching the first data packet.
5. The method according to any one of claims 1 to 3, characterized in that: After generating the first-level hardware forwarding flow table and the second-level hardware forwarding flow table, the method further includes: The first-level hardware forwarding flow table and the second-level hardware forwarding flow table are sent down to the smart network card, and after processing the first data packet according to the second action, the processed first data packet is re-injected into the smart network card, so that the smart network card sends the processed first data packet to the second virtual machine.
6. A data processing method, characterized in that: Applied to a smart network card, the method includes: Receive a first data packet, where the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card; When it is determined that there is no hardware forwarding flow table matching the first data packet, sending the first data packet and the RSS value of the first data packet to the control plane of the virtual switch; Receive a first-level hardware forwarding flow table and a second-level hardware forwarding flow table issued by the control plane of the virtual switch; the virtual switch control plane is used to generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet.
7. The method according to claim 6, characterized in that The method further includes: when receiving the first-level hardware forwarding flow table and the second-level hardware forwarding flow table sent by the control plane of the virtual switch, receiving the processed first data packet; the control plane of the virtual switch is also used to process the first data packet according to the second action to obtain the processed first data packet; The processed first data packet is sent to the second virtual machine.
8. The method according to claim 6, characterized in that The action action in the first-level hardware forwarding flow table includes the first action and the identifier of the second-level hardware forwarding flow table; The keyword key in the second-level hardware forwarding flow table includes its own identifier and a modulo operation result obtained according to the first action, and the action in the second-level hardware forwarding flow table includes the second action.
9. The method according to claim 8, characterized in that The action in the second-level hardware forwarding flow table includes its own identifier and a modulo operation result obtained according to the first action; After receiving the first data packet, the method further includes: When it is determined that there is a hardware forwarding flow table that matches the first data packet triplet, a modulo operation result of the RSS value of the first data packet and an identifier of the second-level hardware forwarding flow table are obtained according to an action in the first-level hardware forwarding flow table that matches the first data packet triplet; the first data packet triplet includes a source IP address, a destination IP address and a protocol number; Searching the second-level hardware forwarding flow table according to the modulo operation result and the identifier of the second-level hardware forwarding flow table; Processing the first data packet according to the action in the second-level hardware forwarding flow table found to obtain a processed first data packet; The processed first data packet is sent to the second virtual machine.
10. A data processing device, characterized in that: Applied to the control plane of a virtual switch, the device comprises: An acquisition module, configured to acquire a first data packet and a receiving end adjustment value RSS value of the first data packet, wherein the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card; The first processing module is used to generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, wherein the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet.
11. A data processing device, characterized in that: Applied in a smart network card, the device comprises: A receiving module, configured to receive a first data packet, where the first data packet is a data packet sent by the first virtual machine to the second virtual machine through the smart network card; a sending module, configured to send the first data packet and the RSS value of the first data packet to a control plane of the virtual switch when it is determined that there is no hardware forwarding flow table matching the first data packet; A second processing module is used to receive a first-level hardware forwarding flow table and a second-level hardware forwarding flow table issued by the control plane of the virtual switch; the control plane of the virtual switch is used to generate a first-level hardware forwarding flow table and a second-level hardware forwarding flow table, the first-level hardware forwarding flow table at least includes a first action of performing a modulo operation on the RSS value according to the number of ports of the second virtual machine, and the second-level hardware forwarding flow table at least includes a modulo operation result obtained according to the first action and a second action of processing the first data packet; The sending module is further used to send the processed first data packet to the second virtual machine.
12. An electronic device, characterized in that: The electronic device comprises a processor and a memory for storing a computer program that can be run on the processor; wherein, The processor is configured to run the computer program to execute the data processing method according to any one of claims 1 to 9.
13. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data processing method according to any one of claims 1 to 9 is implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the data processing method according to any one of claims 1 to 9.