Method for improving data processing capability of virtual network card in multi-core environment

By establishing multiple data channels for the VPN network in a multi -core environment, and using the network card level at the virtual network card level to distinguish and bind, the problem of the unable to send and receiving in parallel of virtual network card packets, and achieve efficient data processing. And throughput efficiency.

CN119383240APending Publication Date: 2025-01-28CRRC NANJING PUZHEN CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411529660.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

In a multi-core environment, virtual network card data packets must be sent and received sequentially through a unique data channel, and cannot be sent and received in parallel on multiple data channels, resulting in low data transmission and reception efficiency and the asynchronous parallel processing of CPU multi-core CPU cannot be fully utilized. Advantages.

Method used

By establishing N data channels in the VPN network, n is the nuclear number of the party with less CPU core, and use the network five yuan group at the virtual network card level to distinguish different network connections. Bind and use the CPU multi -core and handle the virtual network card packets on different data channels.

Benefits of technology

The virtual network card data packets are realized and the response and asynchronous processing, make full use of the advantages of the CPU multi -core step -up parallel processing, thereby improving the data sending and receiving efficiency of virtual network card data, and improving the efficiency of data packet throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119383240A_ABST
    Figure CN119383240A_ABST
Patent Text Reader

Abstract

The invention discloses a method for improving the data processing capability of a virtual network card in a multi-core environment, which relates to the field of information communication and comprises the following steps: two nodes which are successfully connected in a VPN (Virtual Private Network) establish N data channels through a UDP (User Datagram Protocol) or a TCP (Transmission Control Protocol); different network connections are distinguished by using a network quintuple on a virtual network card level, and virtual network card data packets on different network connections are distinguished; carrying out one-to-one corresponding binding on different network connections and the data channels; the virtual network card data packets on different network connections are sent and received through a data channel correspondingly bound with the virtual network card data packets; according to the invention, the CPU multi-core parallel processing of the virtual network card data packets sent and received on different data channels is utilized, and the defects that the virtual network card data packets cannot be sent and received on a plurality of data channels in parallel, and the advantage of asynchronous parallel processing of the CPU multi-core cannot be fully utilized, so that the data processing efficiency of the virtual network card is low are overcome.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information communication, and in particular to a method for improving the data processing capability of a virtual network card in a multi-core environment. Background Art

[0002] VPN is a communication technology that establishes a virtual private network on a real network. It is usually built on the virtual network card of the operating system. The principle is: when the virtual network card receives a network data packet sent by the application software, the VPN software packages the virtual network card data (including the IP header and even the MAC layer header) into a data packet according to a custom protocol, and then sends it to the other end of the VPN. When the other end receives the data packet, it decompresses the custom data packet and writes the payload data (virtual network card data) into the virtual network card, thereby achieving communication in the virtual network.

[0003] Therefore, VPN software is divided into two layers. The inner layer is for receiving and sending data packets on the virtual network card, and the outer layer is for sending and receiving data packets submitted by the virtual network card through the real network. These two layers do not care about each other, that is, the outer layer does not need to care about the content of the data packets obtained from the virtual network card, and can directly send them to the other party through the real network. The inner layer does not need to pay attention to the processing logic of the outer layer, and only needs to treat itself as being in the same virtual private network as the target host. However, this will cause a problem, that is, all data packets must be sent and received through a single real data channel, because it is not known whether the order of these data packets can be disrupted at the virtual network card level, so these data packets can only be sent sequentially on one data channel, and cannot be sent in parallel on multiple data channels. Otherwise, the order of received data packets cannot be guaranteed, and after the data packets are written to the virtual network card, the processing of the protocol stack will be wrong, thereby reducing the efficiency of data sending and receiving.

[0004] When multiple data channels cannot be used to send virtual network card data packets in parallel, the advantages of CPU multi-core cannot be fully utilized, because a single data channel using TCP protocol or UDP protocol cannot take advantage of CPU multi-core. Summary of the invention

[0005] In view of the above-mentioned technical deficiencies, the purpose of the present invention is to provide a method for improving the data processing capability of a virtual network card in a multi-core environment, aiming to solve the problem that all virtual network card data packets must be sent and received sequentially through a unique data channel, and cannot be sent and received in parallel on multiple data channels, and cannot fully utilize the advantages of CPU multi-core asynchronous parallel processing, resulting in low efficiency in virtual network card data sending and receiving.

[0006] In order to solve the above technical problems, the present invention provides a method for improving the data processing capability of a virtual network card in a multi-core environment.

[0007] The first aspect disclosed in the present application provides a method for improving the data processing capability of a virtual network card in a multi-core environment, the method comprising: establishing N data channels through the UDP protocol or the TCP protocol between two nodes that are successfully connected in a VPN network, wherein the value of N is the number of cores of the node with fewer CPU cores; utilizing the network quintuple at the virtual network card level to distinguish different network connections, and distinguishing virtual network card data packets on different network connections, wherein the network quintuple includes a source IP address, a target IP address, a source port, a target port, and a transport layer protocol; binding different network connections to data channels in a one-to-one manner; sending and receiving virtual network card data packets on different network connections through a data channel bound thereto; utilizing the CPU multi-cores of the node to parallelly process the virtual network card data packets sent and received on different data channels, wherein the node's operating system will, under ideal circumstances, assign the running tasks of each data channel to different CPU cores, respectively, to achieve concurrent response and asynchronous processing of sending and receiving virtual network card data packets, and fully utilize the advantages of CPU multi-core asynchronous parallel processing.

[0008] Preferably, the connection between two nodes in a VPN network includes the following steps: the two nodes each start a VPN, generate a virtual network card, and set an IP address at the virtual network card level; one of the two nodes listens to a designated port, and the other connects to the designated port through the public IP address of the node; after the connection is successful, the two nodes perform mutual verification to complete the handshake.

[0009] Preferably, determining the value of N includes the following steps: the two nodes test their own CPU core numbers respectively; the two nodes send their own CPU core numbers to each other; and the minimum value between their own and the other party's CPU core numbers is calculated and assigned to N.

[0010] Preferably, establishing N data channels between two nodes comprises the following steps: the two nodes each start N threads, each thread drives a socket; specifying a transport layer protocol and port to be used for the socket, wherein the transport layer protocol includes the TCP protocol and the UDP protocol, and the port is randomly assigned by the system of each node in the range of 1024 to 65535; the sockets between the two nodes are connected one-to-one through the transport layer protocol and the port to establish N data channels.

[0011] Preferably, the binding also includes reverse binding, that is, the network connection after the source IP address and the target IP address in the network quintuple are interchanged, and the source port and the target port are interchanged, is also bound to the data channel in a one-to-one correspondence.

[0012] The second aspect disclosed in the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the following steps when executing the computer program: two nodes successfully connected in a VPN network establish N data channels through the UDP protocol or the TCP protocol, wherein the value of N is the number of cores of the node with fewer CPU cores; the network quintuple at the virtual network card level is used to distinguish different network connections, and the virtual network card data packets on different network connections are distinguished, wherein the network quintuple includes a source IP address, a target IP address, a source port, a target port and a transport layer protocol; different network connections are respectively bound to data channels in a one-to-one manner; virtual network card data packets on different network connections are sent and received through a data channel corresponding to the data channel; and the virtual network card data packets sent and received on different data channels are processed in parallel by the CPU multi-cores of the node.

[0013] The third aspect disclosed in the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the following steps when executed by a processor: two nodes successfully connected in a VPN network establish N data channels through the UDP protocol or the TCP protocol, wherein the value of N is the number of cores of the node with fewer CPU cores; the network quintuple at the virtual network card level is used to distinguish different network connections, and virtual network card data packets on different network connections are distinguished, wherein the network quintuple includes a source IP address, a target IP address, a source port, a target port, and a transport layer protocol; different network connections are respectively bound to data channels in a one-to-one manner; virtual network card data packets on different network connections are sent and received through a data channel corresponding to the same; and the virtual network card data packets sent and received on different data channels are processed in parallel by the multi-core CPU of the node.

[0014] The beneficial effects of the present invention are as follows: data packets of a virtual network card are sent and received through N different data channels, and the sending and receiving of data packets of the N data channels are respectively run in parallel on N threads, thereby realizing concurrent response and asynchronous processing of sending and receiving data packets of the virtual network card, and making full use of the advantages of CPU multi-core asynchronous parallel processing, thereby improving the efficiency of sending and receiving data of the virtual network card, and improving the data packet throughput efficiency of the virtual network card. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 The overall structure diagram of a method for improving the data processing capability of a virtual network card in a multi-core environment. DETAILED DESCRIPTION

[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0018] The embodiment of the present application provides a method for improving the data processing capability of a virtual network card in a multi-core environment, thereby solving the problem that all virtual network card data packets must be sent and received sequentially through a single data channel, cannot be sent and received in parallel on multiple data channels, and cannot fully utilize the advantages of CPU multi-core asynchronous parallel processing, thereby resulting in low efficiency in sending and receiving data on the virtual network card.

[0019] like Figure 1 As shown, the embodiment of the present application provides a method for improving the data processing capability of a virtual network card in a multi-core environment, and the solution includes: Two nodes that are successfully connected in the VPN network establish N data channels through the UDP protocol or the TCP protocol, where the value of N is the number of cores of the node with fewer CPU cores. Specifically, two nodes in a VPN network connect to each other through IP addresses, ports, and TCP protocols, and then perform a series of mutual verification operations to complete the handshake, at which point the VPN connection between the two sides is successful. Then the two nodes negotiate the number of data channel connections N, and create N data channels through the UDP protocol or TCP protocol.

[0020] Use the network quintuple at the virtual network card level to distinguish different network connections and distinguish the virtual network card data packets on different network connections. The network quintuple includes the source IP address, target IP address, source port, target port and transport layer protocol. Specifically, the network quintuple (source IP address, destination IP address, source port, destination port, transport layer protocol) is used to distinguish different types of network connections at the virtual network card level between two nodes. Generally speaking, the different categories here refer to different source port numbers, different destination port numbers, and different transport layer protocols, so as to distinguish virtual network card data packets on different types of network connections.

[0021] Bind different network connections to data channels one-to-one; Send and receive virtual network card data packets on different network connections through a data channel bound to them; Specifically, data packets on different network connections of the network quintuple are respectively bound to a data channel, so that all subsequent data packets that meet this type of network quintuple are sent through this data channel.

[0022] Use the CPU multi-core of the node to parallelly process the virtual network card data packets sent and received on different data channels; Specifically, the node's operating system will ideally schedule the running tasks of each data channel to different CPU cores, realize concurrent response and asynchronous processing of virtual network card data packets sending and receiving, and make full use of the advantages of CPU multi-core asynchronous parallel processing.

[0023] Further, the connection between two nodes in the VPN network includes the following steps: The two nodes start VPN respectively, generate virtual network cards, and set IP addresses at the virtual network card level; One of the two nodes listens to a designated port, and the other connects to the designated port through the public IP address of the node; After the connection is successful, the two nodes perform mutual verification to complete the handshake.

[0024] Furthermore, before two nodes establish N data channels, they need to negotiate the number of data channel connections N. Determining the value of N includes the following steps: The two nodes test their own CPU core numbers respectively; The two nodes send their CPU core numbers to each other; Calculate the minimum value between your own and the other party's CPU core numbers, and assign it to N.

[0025] Furthermore, two nodes establishing N data channels include the following steps: Each of the two nodes starts N threads, and each thread drives a socket; Specify the transport layer protocol and port used for the socket. The transport layer protocols include TCP and UDP. The ports are randomly assigned by the systems of the respective nodes and range from 1024 to 65535. The sockets between two nodes are connected one-to-one through the transport layer protocol and port to establish N data channels.

[0026] Furthermore, the binding also includes reverse binding, that is, the network connection after the source IP address and the target IP address in the network quintuple are swapped, and the source port and the target port are swapped, is also bound to the data channel in a one-to-one manner; Specifically, when the server receives a data packet, it will also reversely bind the data packet on the virtual network card to the data channel (exchange the source IP and destination IP, and the source port and destination port). In this way, when a data packet is generated on the virtual network card on the server device, it will also find its corresponding bound data channel and then return the data.

[0027] For example, Figure 1 As shown in the figure, the two sides use three data channels to connect for VPN communication. The client will distinguish the network connection at the virtual network card level according to the network quintuple of the data packet, distinguish the Web connection, FTP connection, and SSH connection respectively, and then send them in parallel through the three data channels. Similarly, the server will also record the data channels corresponding to each type of network quintuple, so that when sending data packets, it will also send data separately from the three data channels as required.

[0028] Assume the current environment is: The device at node A has an IPv4 public IP address: 200.1.2.100. The device at Node B has an IPv4 public IP address: 200.1.2.200. The VPN connection uses the TCP protocol. The VPN configuration of device A is: the service port is set to 10000, and the virtual network card IP is 172.31.0.1; the VPN configuration of device B is: the peer IP is configured as 200.1.2.100, the peer port is 10000, and the virtual network card IP is 172.31.0.2.

[0029] The present invention is implemented through the following examples according to the assumed environment: (1) Start and configure VPN Start the VPN in device A, generate a virtual network card, and set the virtual network card IP; The VPN program on device A listens to port 10000 (using TCP protocol); Start the VPN in device B, generate a virtual network card, and set the virtual network card IP.

[0030] (2) Establish VPN port connection At this time, device B will use the TCP protocol to connect to device A through the public network address 200.1.2.100:10000. At this time, the VPN connection on both sides is successful, and then a series of mutual verification operations are performed to complete the handshake (the verification process is irrelevant to the technical solution in the present invention, so it is not described in detail).

[0031] (3) Negotiate the number of physical channel connections Devices A and B both test their own CPU core numbers and send them to each other to negotiate the number of data channel connections. Here, it is assumed that the negotiated number of data channel connections N is 3; Device A creates three threads, each of which drives a socket and listens to three TCP ports (assigned by the system) in the sockets of the three threads. Here, we assume that the three ports are 10001, 10002, and 10003. Then, the three port numbers are sent to device B, waiting for the connection of device B. After receiving the three port numbers, device B also creates three threads, each of which drives a socket to connect to one of the three ports of device A's address 200.1.2.100.

[0032] (4) Data connection classification based on network quintuples On device A, enable a Web service to listen on port 80, enable an FTP service to listen on port 21, and finally enable an SSH service to listen on port 22. Start a browser on device B and access port 80 of device A's VPN network (IP address: 172.31.0.1), that is, http: / / 172.31.0.1:80. Then connect to port 21 of device A's VPN network through FTP software, that is, ftp: / / 172.31.0.1:21. Finally, connect to port 22 of device A's VPN network through SSH client. At this time, the VPN on device B will get three types of network quintuples with different IP packets from the virtual network card: The first category is source IP address: 172.31.0.2, target IP address: 172.31.0.1, source port: 12345 (this is randomly assigned by the system), target port: 80, protocol: TCP; The second category is source IP address: 172.31.0.2, target IP address: 172.31.0.1, source port: 12346 (this is randomly assigned by the system), target port: 21, protocol: TCP; The third category is source IP address: 172.31.0.2, target IP address: 172.31.0.1, source port: 12347 (this is randomly assigned by the system), target port: 22, protocol: TCP.

[0033] (5) Determine the data connection relationship after network quintuple classification Device B binds the three network quintuples to the three data channels connected to device A respectively. In this way, all subsequent packets that meet the first-category packet network quintuple (that is, packets accessing the Web) are sent through the data channel 200.1.2.100:10001. Similarly, all FTP packets are sent through the data channel 200.1.2.100:10002, and all SSH packets are sent through the data channel 200.1.2.100:10003. After receiving the data packet, device A will also reversely bind the three types of data packets on the virtual network card with the three data channels (exchange the source IP and the destination IP, and the source port and the destination port). In this way, when the virtual network card on device A generates a data packet to be returned to device B, it will also be returned to device B through the bound data channel.

[0034] At this point, device A and device B have communicated with three applications, Web, FTP, and SSH, through the virtual network on VPN. At the transport layer level, the data of the virtual network card is sent through three different data channels. The data sending and receiving work of these three data channels runs in parallel on three different threads, thereby accelerating the throughput efficiency.

[0035] In one embodiment, a computer device is provided, which may be a server, and includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, a programming language development environment, and a VPN application. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The programming language development environment and VPN application of the computer device are used for the establishment, operation, and driving of multi-threading and sockets, the mapping of data channels to network quintuples, and the sending and receiving of data packets. The network interface of the computer device is used for network connection communication between different nodes. The computer program is executed by the processor to implement a method for improving the data processing capability of a virtual network card in a multi-core environment.

[0036] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: two nodes successfully connected in a VPN network establish N data channels through the UDP protocol or the TCP protocol, wherein the value of N is the number of cores of the node with fewer CPU cores; the network quintuple at the virtual network card level is used to distinguish different network connections, and virtual network card data packets on different network connections are distinguished, wherein the network quintuple includes a source IP address, a target IP address, a source port, a target port, and a transport layer protocol; different network connections are respectively bound to data channels in a one-to-one manner; virtual network card data packets on different network connections are sent and received through a data channel corresponding to the data channel; and the virtual network card data packets sent and received on different data channels are processed in parallel by the CPU multi-cores of the node.

[0037] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: two nodes that are successfully connected in a VPN network establish N data channels through the UDP protocol or the TCP protocol, wherein the value of N is the number of cores of the node with fewer CPU cores; the network quintuple at the virtual network card level is used to distinguish different network connections, and virtual network card data packets on different network connections are distinguished, wherein the network quintuple includes a source IP address, a target IP address, a source port, a target port, and a transport layer protocol; different network connections are respectively bound to data channels in a one-to-one manner; virtual network card data packets on different network connections are sent and received through a data channel bound to the corresponding network connections; and virtual network card data packets sent and received on different data channels are processed in parallel by the CPU multi-cores of the node.

[0038] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0039] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for improving the data processing capability of a virtual network card in a multi-core environment, characterized in that: include: Two nodes that are successfully connected in the VPN network establish N data channels through the UDP protocol or the TCP protocol, where the value of N is the number of cores of the node with fewer CPU cores. Use the network quintuple at the virtual network card level to distinguish different network connections and distinguish the virtual network card data packets on different network connections. The network quintuple includes the source IP address, target IP address, source port, target port and transport layer protocol. Bind different network connections to data channels one-to-one; Send and receive virtual network card data packets on different network connections through a data channel bound to them; The CPU multi-core of the node is used to parallelly process the virtual network card data packets sent and received on different data channels.

2. A method for improving the data processing capability of a virtual network card in a multi-core environment as claimed in claim 1, characterized in that: The connection between two nodes in a VPN network includes the following steps: The two nodes start VPN respectively, generate virtual network cards, and set IP addresses at the virtual network card level; One of the two nodes listens to a designated port, and the other connects to the designated port through the public IP address of the node; After the connection is successful, the two nodes perform mutual verification to complete the handshake.

3. The method for improving the data processing capability of a virtual network card in a multi-core environment as claimed in claim 1, characterized in that: Determining the value of N involves the following steps: The two nodes test their own CPU core numbers respectively; The two nodes send their CPU core numbers to each other; Calculate the minimum value between your own and the other party's CPU core numbers, and assign it to N.

4. The method for improving the data processing capability of a virtual network card in a multi-core environment as claimed in claim 1, characterized in that: The establishment of N data channels between two nodes includes the following steps: Each of the two nodes starts N threads, and each thread drives a socket; Specify the transport layer protocol and port used for the socket. The transport layer protocols include TCP and UDP. The ports are randomly assigned by the systems of the respective nodes and range from 1024 to 65535. The sockets between two nodes are connected one-to-one through the transport layer protocol and port to establish N data channels.

5. The method for improving the data processing capability of a virtual network card in a multi-core environment as claimed in claim 1, characterized in that: The binding also includes reverse binding, that is, the network connection after the source IP address and the target IP address in the network quintuple are exchanged, and the source port and the target port are exchanged, is also bound to the data channel in a one-to-one manner.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the method for improving the data processing capability of a virtual network card in a multi-core environment according to any one of claims 1 to 5 is implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for improving the data processing capability of a virtual network card in a multi-core environment according to any one of claims 1 to 5 is implemented.