Data Transfer Method, Device, Computer Storage Medium and Electronic Device
By processing and encapsulating the message result information between the data plane development kit and application processes in the operating system, the problem that they cannot process messages in concert is solved, and the complex processing and efficiency improvement of messages is achieved.
Patent Information
- Application Number
- CN202310101910.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-10
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2043-02-10
AI Technical Summary
The data plane development kit and application processes are unable to process messages in coordination, resulting in reduced message processing complexity and increased time cost.
The operating system receives the information packet sent by the data plane development kit, processes and encapsulates the result information, forms a structure data packet, passes it to the application process, and receives the processing results of the application process, encapsulates and passes it back to the data plane development kit.
It realizes the coordinated processing of the same message by the data plane development kit and application processes, improves the complexity and efficiency of message processing, and reduces time costs.
Smart Images

Figure CN116112574B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communication technologies, and in particular, to a data transfer method, apparatus, computer storage medium, and electronic device. Background Art
[0002] In the field of network communication, information requests between different network devices are transmitted through packets. Packets are read from network devices and passed to the kernel for processing through network interfaces provided by the kernel. The packets are forwarded, discarded, or sent to user processes. To improve the processing speed of packets, developers use a data plane development kit for packet reception and transmission operations. That is, after the data plane development kit receives a packet, it is sent to the operating system through a virtual interface, so that the application process of the application program can receive the packet.
[0003] However, the data received by the application process only includes information related to the packet, and does not include the processing result information of the data plane development kit for the packet. Without receiving the result information, more complex processing operations cannot be performed on the packet, and a large amount of time cost will also be consumed.
[0004] In view of the problem that the data plane development kit and the application process cannot cooperate to process packets in the related art, no effective solution has been proposed yet. Summary of the Invention
[0005] The present application provides a data transfer method, apparatus, computer storage medium, and electronic device to solve the problem that the data plane development kit and the application process cannot cooperate to process packets in the related art.
[0006] According to one aspect of the present application, a data transfer method is provided. The method includes: the operating system receives a first information data packet sent by the data plane development kit, and processes the first information data packet to obtain a second information data packet, where the first information data packet is a data packet obtained by the data plane development kit processing first result information, the first result information is information obtained by the data plane development kit processing a target packet, and the target packet is created by the kernel of the operating system; the operating system copies the first result information in the second information data packet into a structure to obtain a first structure data packet, and transfers the first structure data packet to the application process of the application program; the operating system receives second result information sent by the application process, and copies the second information data into a structure to obtain a second structure data packet, where the second result information is information obtained by the application process processing the target packet in the first structure data packet; the operating system transfers the second structure data packet to the data plane development kit.
[0007] Optionally, the Data Plane Development Kit is used to obtain a target packet from the kernel, assemble the packet information of the target packet to obtain first result information, and write the first result information to the tail of a preset data packet to obtain a first information data packet, where the packet information includes at least one of the following: packet type, packet version, packet length, and packet entity information.
[0008] Optionally, the Data Plane Development Kit calls a virtual interface to establish a transfer channel with the operating system. The operating system receives the first information data packet sent by the Data Plane Development Kit, which includes: the operating system receives the first information data packet sent by the Data Plane Development Kit from the transfer channel.
[0009] Optionally, the operating system copies the first result information in the second information data packet into a structure to obtain a first structure data packet, including: processing the first information data packet through the protocol stack of the operating system to obtain a third information data packet, where the operating system includes: an application layer, a transport layer, a network layer, and a data link layer, and the protocol stack is a collection of the protocols of the application layer, transport layer, network layer, and data link layer; transferring the third information data packet to the transport layer in the operating system, and copying the first result information in the third information data packet into a structure and encapsulating it to obtain a first structure data packet.
[0010] Optionally, the application process is used to receive a first modification instruction, respond to the first modification instruction, modify the parameters of a preset acquisition function in the application process to obtain a target acquisition function, and copy the first result information in the first structure data packet to the application process through the acquisition function.
[0011] Optionally, the application process is used to receive a second modification instruction, respond to the second modification instruction, modify the parameters of a preset setting function in the application process to obtain a target setting function, and copy the second result information to the structure through the target setting function.
[0012] Optionally, the operating system transfers the second structure data packet to the Data Plane Development Kit, including: the operating system copies the second result information in the second structure data packet to the tail of a preset data packet for encapsulation to obtain a fourth information data packet; processing the fourth information data packet through the protocol stack of the operating system, and transferring the second result information in the processed fourth information data packet to the Data Plane Development Kit.
[0013] According to another aspect of the present application, a data transfer device is provided. The device includes: a receiving unit, configured to receive a first information data packet sent by a data plane development kit by an operating system and process the first information data packet to obtain a second information data packet, where the first information data packet is a data packet obtained by the data plane development kit processing first result information, the first result information is information obtained by the data plane development kit processing a target message, and the target message is created by a kernel of the operating system; a copying unit, configured to copy the first result information in the second information data packet to a structure by the operating system to obtain a first structure data packet and transfer the first structure data packet to an application process of an application program; a sending unit, configured to receive second result information sent by the application process by the operating system and copy the second information data to a structure to obtain a second structure data packet, where the second result information is information obtained by the application process processing the target message in the first structure data packet; a transferring unit, configured to transfer the second structure data packet to the data plane development kit by the operating system.
[0014] According to another aspect of the embodiments of the present invention, a computer storage medium is further provided. The computer storage medium is used to store a program, where when the program runs, it controls a device where the non-volatile storage medium is located to execute a data transfer method.
[0015] According to another aspect of the embodiments of the present invention, an electronic device is further provided, including a processor and a memory; the memory stores computer-readable instructions, and the processor is configured to run the computer-readable instructions, where when the computer-readable instructions run, they execute a data transfer method.
[0016] Through this application, the following steps are adopted: The operating system receives the first information data packet sent by the data plane development kit and processes the first information data packet to obtain a second information data packet. Among them, the first information data packet is a data packet obtained by the data plane development kit processing the first result information, and the first result information is information obtained by the data plane development kit processing the target packet. The target packet is created by the kernel of the operating system; the operating system copies the first result information in the second information data packet into a structure to obtain a first structure data packet, and transfers the first structure data packet to the application process of the application; the operating system receives the second result information sent by the application process and copies the second information data into a structure to obtain a second structure data packet. Among them, the second result information is information obtained by the application process processing the target packet in the first structure data packet; the operating system transfers the second structure data packet to the data plane development kit, solving the problem that the data plane development kit and the application process cannot cooperate to process packets in the related art. By encapsulating the result information of the device for the packet in the data packet and the structure during the transfer process, and using the transfer process of the data packet and the structure to realize the transfer of the result information, the effect that the data plane development kit and the application process can cooperate to process the same packet is achieved. Description of the Drawings
[0017] The drawings forming a part of this application are used to provide a further understanding of this application. The schematic embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation to this application. In the drawings:
[0018] Figure 1 is a flowchart of the data transfer method provided by an embodiment of this application;
[0019] Figure 2 is a schematic diagram of an optional data transfer method provided by an embodiment of this application Figure 1 ;
[0020] Figure 3 is a schematic diagram of an optional data transfer method provided by an embodiment of this application Figure 2 ;
[0021] Figure 4 is a schematic diagram of the data transfer device provided by an embodiment of this application;
[0022] Figure 5 is a schematic diagram of the electronic device provided by an embodiment of this application. Detailed Embodiments
[0023] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the drawings and in combination with the embodiments.
[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data used in appropriate cases can be interchanged so as to implement the embodiments of the present application described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0026] It should be noted that the relevant information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in the present disclosure are all information and data authorized by the user or fully authorized by all parties.
[0027] According to an embodiment of the present application, a data transfer method is provided.
[0028] Figure 1 is a flowchart of the data transfer method provided according to an embodiment of the present application, as Figure 1 shown, the method includes the following steps:
[0029] Step S102, the operating system receives a first information data packet sent by the data plane development kit, and processes the first information data packet to obtain a second information data packet, where the first information data packet is a data packet obtained by the data plane development kit processing the first result information, and the first result information is information obtained by the data plane development kit processing a target message, and the target message is created by the kernel of the operating system.
[0030] Specifically, the transmission and reception of target packets between the data plane development kit and the application process need to be relayed through the operating system. Here, the operating system can be the kernel, that is, a real-time operating system. The data plane development kit, that is, the DPDK (Data Plane Development Kit), is a high-performance network driver component, which is a library and driver set for processing fast packets and can improve the working efficiency of data plane applications. The application process refers to the application process in the application program.
[0031] Optionally, in the data transfer method provided in the embodiments of the present application, the data plane development kit is used to obtain a target packet from the kernel, assemble the packet information of the target packet to obtain first result information, and write the first result information to the tail of a preset data packet to obtain a first information data packet, where the packet information includes at least one of the following: packet type, packet version, packet length, and packet entity information.
[0032] Specifically, the target packet is created by the kernel of the operating system. The data plane development kit obtains the target packet and assembles the packet information of the target packet to obtain first result information composed of the target packet and the result information obtained by the data plane development kit processing the packet. After processing the first result information, a first information data packet can be obtained. After receiving the first information data packet, the operating system further performs information encapsulation processing on the data packet and records the processed data packet as a second information data packet, where the packet information may include relevant information such as packet type, packet version, and packet length.
[0033] It should be noted that the first information data packet is obtained by the operating system encapsulating the first result information into the tail of the preset data packet, that is, copying the first result information to the variable-length area, so that the header part and the first result information are jointly encapsulated as the first information data packet. Here, the preset data packet, that is, the sk_buffer buffer data packet, is a buffer used by the operating system kernel to manage network data packets, which describes the received or to-be-sent data packet information and is divided into two parts: a fixed-size header of the sk_buff type and a variable-length area sufficient to accommodate all or part of the data of a single data packet.
[0034] Step S104, the operating system copies the first result information in the second information data packet into a structure to obtain a first structure data packet, and transfers the first structure data packet to the application process of the application program.
[0035] Specifically, the operating system copies the first result information in the second information data packet obtained after processing to the tail of the structure in the operating system, and forms a data packet together with the main body part of the structure, which is denoted as the first structure data packet. Through this structure data packet, the information of the data plane development kit for processing packets and the packet information can be jointly transmitted to the application process.
[0036] Step S106, the operating system receives the second result information sent by the application process, and copies the second information data to the structure to obtain the second structure data packet, where the second result information is the information obtained by the application process processing the target packet in the first structure data packet.
[0037] Specifically, to enable the data plane development kit and the application process to form collaborative processing of a certain target packet, after receiving the first structure data packet, the application process performs secondary processing on the target packet in the first structure data packet, and records the result information obtained from the secondary processing as the second result information, and transmits the second result information to the operating system.
[0038] After the operating system receives the second result information, it copies the result information to the tail of the structure therein, and forms a new data packet together with the main body part of the structure, which is denoted as the second structure data packet.
[0039] Step S108, the operating system transmits the second structure data packet to the data plane development kit.
[0040] Specifically, after obtaining the second structure data packet, copy and perform protocol stack processing on the second result information in the data packet, and transmit the processed second result information to the data plane development kit to complete the collaborative processing of a certain target packet by the data plane development kit and the application process and the transmission of the result data.
[0041] The data transfer method provided by the embodiment of the present application receives, through the operating system, a first information data packet sent by the data plane development kit, and processes the first information data packet to obtain a second information data packet. Among them, the first information data packet is a data packet obtained by the data plane development kit processing the first result information, and the first result information is information obtained by the data plane development kit processing the target packet. The target packet is created by the kernel of the operating system; the operating system copies the first result information in the second information data packet into a structure to obtain a first structure data packet, and transfers the first structure data packet to the application process of the application program; the operating system receives the second result information sent by the application process, and copies the second information data into the structure to obtain a second structure data packet. Among them, the second result information is information obtained by the application process processing the target packet in the first structure data packet; the operating system transfers the second structure data packet to the data plane development kit, which solves the problem that the data plane development kit and the application process cannot cooperate to process packets in the related art. By encapsulating the result information of the device for the packet in the data packet and the structure during the transfer process, and using the transfer process of the data packet and the structure to implement the transfer of the result information, the effect that the data plane development kit and the application process can cooperate to process the same packet is achieved.
[0042] Optionally, in the data transfer method provided by the embodiment of the present application, the data plane development kit calls a virtual interface to establish a transfer channel with the operating system. The operating system receiving the first information data packet sent by the data plane development kit includes: the operating system receives the first information data packet sent by the data plane development kit from the transfer channel.
[0043] Specifically, data is transferred between the data plane development kit and the operating system through a virtual transmission channel. The virtual interface can be kni. After calling the virtual interface, a virtual channel can be established between the two, and the first information data packet is transferred from the data plane development kit to the operating system through the channel.
[0044] Optionally, in the data transfer method provided by the embodiment of the present application, the operating system copying the first result information in the second information data packet into a structure to obtain a first structure data packet includes: processing the first information data packet through the protocol stack of the operating system to obtain a third information data packet. Among them, the operating system includes: the application layer, the transport layer, the network layer, and the data link layer. The protocol stack is a collection of the protocols of the application layer, the transport layer, the network layer, and the data link layer; transferring the third information data packet to the transport layer in the operating system, and copying the first result information in the third information data packet into the structure to encapsulate and obtain the first structure data packet.
[0045] After the operating system receives the first information data packet, it needs to process the first information data packet. Specifically, the first information data packet is processed through the protocol stack of the operating system, and the processing method is to modify the parameters of the data packet. After modification, a third information data packet can be obtained. The third information data packet is continuously transmitted to the sock structure in the transport layer of the operating system, that is, the first result information included in the third information data packet is copied to the variable area of the structure, and the first structure data packet is encapsulated.
[0046] It should be noted that the operating system includes four layers of structures, namely the application layer, the transport layer, the network layer, and the data link layer. The protocol stack refers to the sum of the protocols at each layer in the network, that is, the collection of the protocols of the application layer, the transport layer, the network layer, and the data link layer, and it is also the specific implementation form of the protocol. The transport layer can enable the operating system to establish a connection with the application process. The sock structure serves as a "transfer station" between each layer, and the data packets transmitted by any party will be temporarily cached in the buffer queue of the sock structure.
[0047] Optionally, in the data transfer method provided in the embodiment of the present application, the application process is used to receive a first modification instruction, respond to the first modification instruction, modify the parameters of a preset acquisition function in the application process to obtain a target acquisition function, and copy the first result information in the first structure data packet to the application process through the acquisition function.
[0048] Specifically, when the operating system transfers data to the application process, first, the application process will receive and respond to a modification instruction, that is, the first modification instruction. Through this instruction, the parameters of the preset acquisition function in the application process, that is, the parameters of the getsockopt function, are modified to obtain a target acquisition function, so that the external transmitted data can be obtained through this acquisition function. Therefore, the application process can obtain the first structure data packet through the target acquisition function and extract the first result information in the first structure data packet into the application process.
[0049] Optionally, in the data transfer method provided in the embodiment of the present application, the application process is used to receive a second modification instruction, respond to the second modification instruction, modify the parameters of a preset setting function in the application process to obtain a target setting function, and copy the second result information to the structure through the target setting function.
[0050] Specifically, after the application process receives the target message in the first structure data packet, it performs secondary processing on the message, and records the processed result as the second result information. To transmit the second result information to the Data Plane Development Kit (DPDK), first, the application process receives and responds to the second modification instruction, which is used to modify the parameters of the preset setting function in the application process. After modification, the target setting function, that is, the setsockopt function, can be obtained. Through this function, the second result information is transmitted out of the application process and copied to the tail of the sock structure of the operating system for encapsulation, obtaining the second structure data packet.
[0051] Optionally, in the data transmission method provided in the embodiment of the present application, the operating system transmits the second structure data packet to the Data Plane Development Kit (DPDK), including: the operating system copies the second result information in the second structure data packet to the tail of a preset data packet for encapsulation, obtaining the fourth information data packet; and processes the fourth information data packet through the protocol stack of the operating system, and transmits the second result information in the processed fourth information data packet to the Data Plane Development Kit (DPDK).
[0052] Specifically, when the operating system receives the second structure data packet, it first copies out the second result information in the second structure data packet and copies it to the preset data packet. The preset data packet can be the sk_buffer buffer data packet. The second result information is copied to the tail of the sk_buffer buffer data packet for encapsulation, obtaining the fourth information data packet. Then, after the fourth information data packet is processed by the protocol stack, the processed second result information is obtained, and this result information is transmitted to the Data Plane Development Kit (DPDK), thus completing the collaborative processing between the application process and the Data Plane Development Kit (DPDK).
[0053] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0054] The embodiment of the present application also provides a data transmission method. Figure 2 It is a schematic diagram of the optional data transmission method provided according to the embodiment of the present application. Figure 1 As Figure 2 shown, this method includes:
[0055] After the Data Plane Development Kit receives the target packet, the packet is processed to obtain the result information dpdk_process_data. The result information is encapsulated at the tail of the preset data packet, that is, the tail of the sk_buffer, to obtain the first information data packet. The first information data packet is transmitted through the virtual interface to the operating system kernel. After being processed by the protocol stack, the operating system extracts and copies the result information in the first data packet into the sock structure of the operating system, and forms the first structure data packet with the sock structure and the result information as the main body.
[0056] Before the first structure data packet is continuously transmitted, the application process modifies the parameters of the getsockopt function in it, so that the first structure data packet transmitted by the operating system can be obtained by using this parameter, that is, the application process can obtain the result information dpdk_process_data processed by the Data Plane Development Kit and the target packet.
[0057] When the application process performs secondary processing on the incoming target packet and obtains the second processing result, before the second processing result is transmitted, first modify the setting function in the application process, that is, modify the setsockopt function. After modification, the processing result can be transmitted to the structure of the operating system. The second processing result is copied to the tail of the structure to obtain the second structure data packet, and then the second processing result in the second structure data packet is copied to the tail of the sk_buffer to obtain the fourth information data packet, and the data packet is processed by the protocol stack and then transmitted to the Data Plane Development Kit to complete the collaborative processing of the packet by the Data Plane Development Kit and the application process.
[0058] In this embodiment, by copying the result information to the tail of the data packet used for transmitting data information between the Data Plane Development Kit and the application process, while improving the packet processing speed, the collaborative complex processing of the same packet by the Data Plane Development Kit and the application process is realized.
[0059] The embodiment of the present application also provides a data transmission method. Figure 3 It is a schematic diagram of an optional data transmission method provided according to the embodiment of the present application. Figure 2 As Figure 3 shown, the method includes:
[0060] After the Data Plane Development Kit obtains multiple target packets, the multiple packets are grouped and processed according to the types of the packets to obtain multiple types of packet groups and corresponding grouping information, which are recorded as the first grouping information, that is, group1, the second grouping information, that is, group2, etc.
[0061] The Data Plane Development Kit copies the first packet information to the tail of the preset data packet sk_buffer, encapsulates it to obtain the fifth information data packet, and sends it to the operating system through the virtual interface. After receiving the data packet, the operating system processes the data packet through the protocol stack, and copies the first packet information at the tail of the preset data packet to the tail of the sock structure to obtain the third structure data packet.
[0062] At the same time, the application process modifies the parameters of the acquisition function therein, so that the process can obtain the third structure data packet sent by the operating system through the modified acquisition function, and extracts the first packet information in the data packet to complete the reception operation of the application process.
[0063] In this embodiment, multiple packets are grouped according to different types to obtain multiple packet sets of different types, and the packet information of each group of packets is copied to the tail of the data packet used for transmission between the Data Plane Development Kit and the application process, realizing the transfer operation of the packet grouping information. Subsequently, complex processing of the packet data can be coordinated according to the grouping information.
[0064] The embodiment of the present application also provides a data transfer device. It should be noted that the data transfer device in the embodiment of the present application can be used to execute the data transfer method provided in the embodiment of the present application. The data transfer device provided in the embodiment of the present application is introduced below.
[0065] Figure 4 is a schematic diagram of the data transfer device provided in the embodiment of the present application, as Figure 4 shown, the device includes a receiving unit 40, a copying unit 41, a sending unit 42, and a transferring unit 43:
[0066] The receiving unit 40 is used for the operating system to receive the first information data packet sent by the Data Plane Development Kit and process the first information data packet to obtain the second information data packet. Among them, the first information data packet is the data packet obtained by the Data Plane Development Kit processing the first result information, and the first result information is the information obtained by the Data Plane Development Kit processing the target packet. The target packet is created by the kernel of the operating system;
[0067] The copying unit 41 is used for the operating system to copy the first result information in the second information data packet to the structure to obtain the first structure data packet, and transfer the first structure data packet to the application process of the application program;
[0068] The sending unit 42 is used for the operating system to receive the second result information sent by the application process and copy the second information data to the structure to obtain the second structure data packet. Among them, the second result information is the information obtained by the application process processing the target packet in the first structure data packet;
[0069] A transfer unit 43 for the operating system to transfer the second structure data packet to the data plane development kit.
[0070] Optionally, in the data transfer device provided in the embodiment of the present application, the data plane development kit is used to obtain a target message from the kernel, assemble the message information of the target message to obtain first result information, and write the first result information to the tail of a preset data packet to obtain a first information data packet, where the message information includes at least one of the following: message type, message version, message length, and message entity information.
[0071] Optionally, in the data transfer device provided in the embodiment of the present application, the receiving unit 40 includes: a receiving module for the operating system to receive the first information data packet sent by the data plane development kit from the transfer channel.
[0072] Optionally, in the data transfer device provided in the embodiment of the present application, the copying unit 41 includes: a first processing module for processing the first information data packet through the protocol stack of the operating system to obtain a third information data packet, where the operating system includes: an application layer, a transport layer, a network layer, and a data link layer, and the protocol stack is a set of protocols of the application layer, transport layer, network layer, and data link layer; a transfer module for transferring the third information data packet to the transport layer in the operating system and copying the first result information in the third information data packet into a structure to encapsulate and obtain a first structure data packet.
[0073] Optionally, in the data transfer device provided in the embodiment of the present application, the application process is used to receive a first modification instruction, respond to the first modification instruction, modify the parameters of a preset acquisition function in the application process to obtain a target acquisition function, and copy the first result information in the first structure data packet to the application process through the acquisition function.
[0074] Optionally, in the data transfer device provided in the embodiment of the present application, the application process is used to receive a second modification instruction, respond to the second modification instruction, modify the parameters of a preset setting function in the application process to obtain a target setting function, and copy the second result information to the structure through the target setting function.
[0075] Optionally, in the data transfer device provided in the embodiment of the present application, the transfer unit 43 includes: an encapsulation module for the operating system to copy the second result information in the second structure data packet to the tail of a preset data packet for encapsulation to obtain a fourth information data packet; a second processing module for processing the fourth information data packet through the protocol stack of the operating system and transferring the second result information in the processed fourth information data packet to the data plane development kit.
[0076] The data transfer device provided by the embodiment of the present application includes a receiving unit 40, which is used for the operating system to receive the first information data packet sent by the data plane development kit and process the first information data packet to obtain a second information data packet. The first information data packet is a data packet obtained by the data plane development kit processing the first result information, and the first result information is information obtained by the data plane development kit processing the target packet. The target packet is created by the kernel of the operating system; a copying unit 41, which is used for the operating system to copy the first result information in the second information data packet into a structure to obtain a first structure data packet and transfer the first structure data packet to the application process of the application program; a sending unit 42, which is used for the operating system to receive the second result information sent by the application process and copy the second information data into a structure to obtain a second structure data packet, where the second result information is information obtained by the application process processing the target packet in the first structure data packet; a transferring unit 43, which is used for the operating system to transfer the second structure data packet to the data plane development kit, solving the problem in the related art that the data plane development kit and the application process cannot cooperate to process packets. By encapsulating the result information of the device for the packet in the data packet and the structure during the transfer process, and using the transfer process of the data packet and the structure to implement the transfer of the result information, the effect that the data plane development kit and the application process can cooperate to process the same packet is achieved.
[0077] The above data transfer device includes a processor and a memory. The above receiving unit 40, copying unit 41, sending unit 42, and transferring unit 43 are all stored in the memory as program units, and the corresponding functions are implemented by the processor executing the above program units stored in the memory.
[0078] The processor contains a kernel, and the kernel retrieves the corresponding program units from the memory. One or more kernels can be set, and by adjusting the kernel parameters, the problem in the related art that the data plane development kit and the application process cannot cooperate to process packets is solved.
[0079] The memory may include non-permanent memory in a computer-readable medium, forms such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM), and the memory includes at least one storage chip.
[0080] The embodiment of the present application also provides a computer storage medium, which is used to store a program. When the program runs, it controls the device where the non-volatile storage medium is located to execute a data transfer method.
[0081] The embodiment of the present application also provides an electronic device, Figure 5 is a schematic diagram of the electronic device provided by the embodiment of the present application, asFigure 5 As shown, the electronic device 50 includes a processor and a memory; computer-readable instructions are stored in the memory, and the processor is used to run the computer-readable instructions. Among them, when the computer-readable instructions run, a data transfer method is executed. The electronic device in this article can be a server, a PC, a PAD, a mobile phone, etc.
[0082] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0083] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the processes and / or blocks in the flowchart and / or block diagram can also be implemented. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for realizing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0084] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device realizes the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0085] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Therefore, the instructions executed on the computer or other programmable device provide steps for realizing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0086] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0087] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0088] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0089] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0090] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A data transfer method, characterized in that, it includes: The operating system receives a first information data packet sent by the data plane development kit, and processes the first information data packet to obtain a second information data packet, where the first information data packet is a data packet obtained by the data plane development kit processing first result information, and the first result information is information obtained by the data plane development kit processing a target message, and the target message is created by the kernel of the operating system; The operating system copies the first result information in the second information data packet into a structure to obtain a first structure data packet, and transfers the first structure data packet to an application process of the application program; The operating system receives second result information sent by the application process, and copies the second information data into the structure to obtain a second structure data packet, where the second result information is information obtained by the application process processing the target message in the first structure data packet; The operating system transfers the second structure data packet to the data plane development kit.
2. The method according to claim 1, characterized in that, The data plane development kit is used to obtain the target message from the kernel, assemble the message information of the target message to obtain the first result information, and write the first result information to the tail of a preset data packet to obtain the first information data packet, where the message information includes at least one of the following information: message type, message version, message length, and message entity information.
3. The method according to claim 1, characterized in that, The data plane development kit calls a virtual interface to establish a transfer channel with the operating system, and the operating system receiving the first information data packet sent by the data plane development kit includes: The operating system receives the first information data packet sent by the data plane development kit from the transfer channel.
4. The method according to claim 1, characterized in that, The operating system copying the first result information in the second information data packet into a structure to obtain a first structure data packet includes: Processing the first information data packet through the protocol stack of the operating system to obtain a third information data packet, where the operating system includes: an application layer, a transport layer, a network layer, and a data link layer, and the protocol stack is a collection of protocols of the application layer, the transport layer, the network layer, and the data link layer; Transferring the third information data packet to the transport layer in the operating system, and copying the first result information in the third information data packet into the structure to encapsulate and obtain the first structure data packet.
5. The method according to claim 1, characterized in that, The application process is configured to receive a first modification instruction, respond to the first modification instruction, modify parameters of a preset acquisition function in the application process to obtain a target acquisition function, and copy the first result information in the first structure data packet to the application process through the acquisition function.
6. The method according to claim 1, wherein, the application process is configured to receive a second modification instruction, respond to the second modification instruction, modify parameters of a preset setting function in the application process to obtain a target setting function, and copy the second result information to the structure through the target setting function.
7. The method according to claim 1, wherein, the operating system delivering the second structure data packet to the data plane development kit includes: the operating system copies the second result information in the second structure data packet to the tail of a preset data packet for encapsulation to obtain a fourth information data packet; process the fourth information data packet through the protocol stack of the operating system, and deliver the second result information in the processed fourth information data packet to the data plane development kit.
8. A data transfer device, wherein, it includes: a receiving unit, configured to receive, by the operating system, a first information data packet sent by the data plane development kit and process the first information data packet to obtain a second information data packet, wherein the first information data packet is a data packet obtained by the data plane development kit processing first result information, the first result information is information obtained by the data plane development kit processing a target message, and the target message is created by the kernel of the operating system; a copying unit, configured to copy, by the operating system, the first result information in the second information data packet to a structure to obtain a first structure data packet, and deliver the first structure data packet to an application process of an application program; a sending unit, configured to receive, by the operating system, second result information sent by the application process and copy the second information data to the structure to obtain a second structure data packet, wherein the second result information is information obtained by the application process processing the target message in the first structure data packet; a delivering unit, configured to deliver, by the operating system, the second structure data packet to the data plane development kit.
9. A computer storage medium, wherein, the computer storage medium is used to store a program, wherein when the program is executed by a processor, it controls a device where the computer storage medium is located to execute the data transfer method according to any one of claims 1 to 7.
10. An electronic device, wherein, it includes a processor and a memory, and computer-readable instructions are stored in the memory, and the processor is configured to run the computer-readable instructions, wherein when the computer-readable instructions are running, they execute the data transfer method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Network data packet parallel processing method based on Intel DPDK
CN105577567A
Message transmission method, medium and device in virtual network and computing equipment
CN110048963A