A method and apparatus for processing a datagram, an electronic device, and a storage medium

By employing VIRTIO-USER technology to construct a high-performance kernel interaction mechanism in a multi-process mode between user space and kernel space, the problem of low data interaction efficiency between user space and kernel space is solved, thereby improving data processing performance and the stability and recursive capability of intranet DNS products.

CN119892957BActive Publication Date: 2025-11-04CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411791216.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-11-04
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

The low efficiency of data interaction between user space and kernel space leads to low data processing efficiency, and the heavy consumption of KNI resources also affects data processing performance.

Method used

A high-performance kernel interaction processing mechanism in a multi-process mode is constructed using VIRTIO-USER technology. Multiple user-mode processes communicate with the kernel-mode VHost, and each process interacts with data through its unique datagram address queue, achieving lock-free and contention-free resource access.

Benefits of technology

It enhances the datagram forwarding and processing capabilities between kernel mode and user mode, improves product stability and the recursive capabilities of intranet DNS products, decouples the dependency on KNI, and makes full use of multi-core forwarding mechanisms to process data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892957B_ABST
    Figure CN119892957B_ABST
Patent Text Reader

Abstract

The application provides a data packet processing method and device, electronic equipment and a storage medium. The application constructs a high-performance kernel interaction processing mechanism under a multi-process service based on DPDK, and realizes a communication mechanism in a multi-process mode. In the multi-process mode, there are multiple data packet address queues, each process communicates with a VHost in a kernel mode through a unique corresponding data packet address queue, resource access between processes is lock-free and contention-free, multi-core forwarding mechanism is fully utilized to process data, the forwarding processing capacity of data packets between the kernel mode and the user mode is improved, and the stability of the product and the recursion capability of the intranet DNS product are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of cloud computing, and particularly relates to a data packet processing method and device, electronic equipment and storage medium. BACKGROUND

[0002] DPDK (Data Plane Development Kit) is an excellent packet receiving and sending device, which does not provide a user mode protocol stack, and therefore has the need to inject data packets into a kernel protocol stack.

[0003] Among them, KNI is an interface between the user mode and the kernel mode, and is more efficient than the traditional TAP device (a kind of virtual network device used to simulate a physical network interface) because it does not have system calls and memory copying. SUMMARY

[0004] The present application shows a data packet processing method, device, electronic equipment and storage medium.

[0005] In a first aspect, the present application shows a data packet processing method, which comprises:

[0006] For any one of a plurality of user mode processes in the DPDK (Data Plane Development Kit) in the user mode, after receiving a first data packet sent by a network card in the user mode through the user mode process, the first data packet is cached in a shared memory through the user mode process, and the shared memory is open to access by the user mode and the kernel mode;

[0007] The address of the first data packet in the shared memory is obtained through the user mode process;

[0008] The address is cached in a data packet address queue corresponding to the user mode process only through the user mode process; the data packet address queues corresponding to different user mode processes are different, and the data packet address queues corresponding to each user mode process are open to access by the user mode and the kernel mode;

[0009] The IOevent file descriptor corresponding to the data packet address queue only is obtained through the user mode process; the IOevent file descriptors corresponding to different data packet address queues are different;

[0010] The IOevent file descriptor is sent to the VHost (Virtual Host) in the kernel mode through the user mode process;

[0011] The IOevent file descriptor is received by the VHost in the kernel mode;

[0012] extracting, by the VHost in the kernel mode, the address of the first datagram in the shared memory according to the IOevent file descriptor in the datagram address queue uniquely corresponding to the IOevent file descriptor;

[0013] extracting, by the VHost in the kernel mode, the first datagram in the shared memory according to the address;

[0014] sending, by the VHost in the kernel mode, the first datagram to the protocol stack in the kernel mode for processing.

[0015] In a second aspect, the application shows a method for processing a datagram, the method comprising:

[0016] obtaining, by the VHost in the kernel mode, a second datagram processed by the protocol stack in the kernel mode for the first datagram;

[0017] caching, by the VHost in the kernel mode, the second datagram in the shared memory; the shared memory is open to the user mode and the kernel mode for access;

[0018] obtaining, by the VHost in the kernel mode, the address of the second datagram in the shared memory;

[0019] determining, by the VHost in the kernel mode, a datagram address queue uniquely corresponding to a user mode process for processing the second datagram in a plurality of user mode processes independent of each other in a data plane development kit (DPDK) in the user mode;

[0020] caching, by the VHost in the kernel mode, the address in the datagram address queue uniquely corresponding to the determined user mode process; the datagram address queues uniquely corresponding to different user mode processes are different, and the datagram address queues uniquely corresponding to each user mode process are open to the user mode and the kernel mode for access;

[0021] listening, by the determined user mode process, to whether the address is added in the datagram address queue;

[0022] extracting, by the determined user mode process, the address of the second datagram in the shared memory in the datagram address queue in the case that the address is added in the datagram address queue;

[0023] extracting, by the determined user mode process, the second datagram in the shared memory according to the address;

[0024] sending, by the determined user mode process, the second datagram to a network card in the user mode.

[0025] In a third aspect, the application shows a device for processing a datagram, the device comprising:

[0026] The first cache module is configured to cache, by the user state process, the first datagram in the shared memory after the user state process receives the first datagram sent by the network card in the user state, and the shared memory is open to access in the user state and the kernel state.

[0027] The first obtaining module is configured to obtain, by the user state process, an address of the first datagram in the shared memory.

[0028] The second cache module is configured to cache, by the user state process, the address in a datagram address queue corresponding to the user state process only; the datagram address queues corresponding to different user state processes are different, and the datagram address queues corresponding to each user state process are open to access in the user state and the kernel state.

[0029] The second obtaining module is configured to obtain, by the user state process, an IOevent file descriptor corresponding to the datagram address queue only; the IOevent file descriptors corresponding to different datagram address queues are different.

[0030] The first sending module is configured to send, by the user state process, the IOevent file descriptor to a virtual host (VHost) in the kernel state.

[0031] The receiving module is configured to receive, by the VHost in the kernel state, the IOevent file descriptor.

[0032] The first extracting module is configured to extract, by the VHost in the kernel state, an address of the first datagram in the shared memory according to the IOevent file descriptor in the datagram address queue corresponding to the IOevent file descriptor only.

[0033] The second extracting module is configured to extract, by the VHost in the kernel state, the first datagram in the shared memory according to the address.

[0034] The second sending module is configured to send, by the VHost in the kernel state, the first datagram to a protocol stack in the kernel state.

[0035] In a fourth aspect, the application shows a datagram processing device, and the device comprises:

[0036] The third obtaining module is configured to obtain, by the VHost in the kernel state, a second datagram obtained by processing the first datagram by the protocol stack in the kernel state.

[0037] The third caching module is configured to cache the second datagram in the shared memory through the VHost in the kernel mode; and the shared memory is open to access of the user mode and the kernel mode.

[0038] The fourth obtaining module is configured to obtain the address of the second datagram in the shared memory through the VHost in the kernel mode.

[0039] The determining module is configured to determine, through the VHost in the kernel mode, a datagram address queue corresponding to a user mode process only for processing the second datagram in a plurality of user mode processes independent of each other in a data plane development kit (DPDK) in the user mode.

[0040] The fourth caching module is configured to cache the address in the datagram address queue corresponding to the user mode process only in the determined user mode process; the datagram address queues corresponding to different user mode processes are different, and the datagram address queues corresponding to each user mode process are open to access of the user mode and the kernel mode.

[0041] The listening module is configured to listen, through the determined user mode process, whether the address is added in the datagram address queue.

[0042] The third extracting module is configured to extract, through the determined user mode process, the address of the second datagram in the shared memory in the datagram address queue in a case where the address is added in the datagram address queue.

[0043] The fourth extracting module is configured to extract, through the determined user mode process, the second datagram in the shared memory according to the address.

[0044] The third sending module is configured to send, through the determined user mode process, the second datagram to a network card in the user mode.

[0045] In a fifth aspect, an electronic device is provided, which includes a processor, and a memory for storing processor-executable instructions; wherein the processor is configured to perform the method in any of the above aspects.

[0046] In a sixth aspect, a non-transitory computer-readable storage medium is provided, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the method in any of the above aspects.

[0047] In a seventh aspect, a computer program product is provided, which, when instructions in the computer program product are executed by a processor of an electronic device, enables the electronic device to perform the method in any of the above aspects.

[0048] The technical scheme provided by the present application can have the following beneficial effects:

[0049] The application constructs a high-performance kernel interaction processing mechanism under a DPDK-based multi-process service, and realizes a communication mechanism in a multi-process mode. In the multi-process mode, there are multiple datagram address queues, each process communicates with the VHost in the kernel mode through its unique corresponding datagram address queue, resource access between processes is lock-free and contention-free, multi-core forwarding mechanism is fully utilized to process data, the forwarding processing capacity of datagrams between the kernel mode and the user mode is improved, and the stability of the product and the recursion capability of the intranet DNS product are improved. BRIEF DESCRIPTION OF DRAWINGS

[0050] Figure 1 is a schematic diagram of a datagram processing architecture of the application.

[0051] Figure 2 is a schematic diagram of a datagram processing architecture of the application.

[0052] Figure 3 is a step flowchart of a datagram processing method of the application.

[0053] Figure 4 is a step flowchart of a datagram processing method of the application.

[0054] Figure 5 is a structural block diagram of a datagram processing device of the application.

[0055] Figure 6 is a structural block diagram of a datagram processing device of the application.

[0056] Figure 7 is a block diagram of an electronic device of the application.

[0057] Figure 8 is a block diagram of an electronic device of the application. DETAILED DESCRIPTION

[0058] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are some of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the application.

[0059] In the KNI mode, after receiving the datagram from the network card, the user mode program based on DPDK puts the datagram to be forwarded to the kernel processing into the FIFO shared memory in the form of FIFO (First Input First Output, first-in first-out) shared memory.

[0060] In the kernel state, a KNI_thread (thread) is started to obtain a datagram from the FIFO shared memory, copy the datagram to the memory in the kernel state, enter the kernel protocol stack for processing, and then send to the application for processing.

[0061] After the application processing is completed, the processed datagram is placed in the FIFO shared memory through the kernel protocol stack and the TAP device.

[0062] The user state program based on DPDK rounds the FIFO shared memory to process the processed datagram, and sends the processed datagram from DPDK and the network card to the network.

[0063] However, the inventors find that the above problems have the following defects:

[0064] The KNI only supports single queue interaction between the user state and the kernel state, and in the case of a large amount of data interaction between the user state and the kernel state, the efficiency of data interaction is low, resulting in low efficiency of data processing and performance bottleneck.

[0065] In addition, the log service also uses the KNI to communicate with the log server in the log aspect, and the KNI and the log server communicate in the log aspect, which occupies part of the resources of the KNI, and aggravates the performance problem of the KNI in the data interaction between the user state and the kernel state.

[0066] Secondly, the single queue supported by the KNI between the user state and the kernel state is maintained by the master process of the user state, and the slave process of the user state needs to interact with the master process to obtain the address of the data from the queue maintained by the master process, etc., resulting in a large amount of interaction between the master process and the slave process in the user state, occupying system resources, and aggravating the problem of low efficiency of data processing.

[0067] Therefore, the scheme of the present application is proposed.

[0068] Before introducing the scheme of the present application, the technical terms that may be involved in the present application are explained.

[0069] DNS (Domain Name System, domain name system) is a distributed database on the Internet that maps domain names and IP (Internet Protocol) addresses, making it more convenient for users to access the Internet without memorizing IP number strings that can be directly read by machines. The process of obtaining the IP address corresponding to the host name through the host name is called domain name resolution (or host name resolution). The DNS protocol runs on the UDP (User Datagram Protocol) protocol and uses port number 53.

[0070] DPDK, is a software library for datagram processing on general-purpose multi-core processors, which can bypass the Linux kernel protocol stack to improve message processing efficiency.

[0071] KNI: used to send datagrams back to the kernel after processing, so as not to implement all protocols in the DPDK layer.

[0072] IOevent (Input / Ooutput event) file descriptor, used to identify the datagram address queue.

[0073] VHost (Virtual Host), is a technology that builds multiple website services belonging to different domain names or based on different IP addresses on the same machine. It can assign different IP (Internet Protocol) addresses and ports to each website running on the same physical machine, and also allows multiple websites to have different domain names.

[0074] BIND9 (Berkeley Internet Name Domain version 9) is the latest version of the BIND (Berkeley Internet Name Domain) series, which is a widely used open source DNS server software. It is mainly used to resolve the mapping relationship between domain names and IP addresses, and provides domain name resolution services.

[0075] VIRTIO-USER: initially introduced with the VIRTIO-USER backend as a high-performance solution for IPC (Inter-Process Communication) and user space container networking. It is a solution proposed by DPDK for specific scenarios, which has two main uses, one is for DPDK application containers to support VIRTIO, and the other is for communication with the kernel.

[0076] One of the uses of VIRTIO-USER is as an exception path for communication with the kernel. DPDK is a bypass kernel solution, which is the reason for its high performance, but sometimes the datagrams received from DPDK (such as control messages) need to be sent to the kernel protocol stack for processing. This path is called exception path in DPDK.

[0077] The technical solution adopts the technology of VIRTIO-USER, and on this basis, a multi-process VIRTIO-USER forwarding model is established, and a high-performance kernel interaction processing architecture under the multi-process service based on DPDK is constructed. The VIRTIO-USER mode under the multi-process mode is realized. In the multi-process mode, each process respectively communicates with the VHost in the kernel mode through the unique corresponding datagram address queue thereof, the resource access between the processes is lock-free and contention-free, the multi-core forwarding system is fully utilized to process data, and the datagram forwarding processing capability between the kernel mode and the user mode is improved.

[0078] In the multi-process mode, when the master user mode process (master) is started, the shared memory and the datagram address queue corresponding to each user mode process (including the master user mode process and each slave user mode process) are initialized.

[0079] When the slave user mode process is started, the IOevent file descriptor corresponding to the unique datagram address queue corresponding to the slave user mode process is obtained from the master user mode process. When the slave user mode process interacts with the VHost in the kernel mode, the slave user mode process interacts with the VHost in the kernel mode through the IOevent file descriptor, and the transmission and reception of the datagram are realized.

[0080] The scheme of the present application can be applied in a cloud network intranet DNS product, and relates to an intranet DNS network element device. The current intranet DNS realizes the separation of recursive cache function, and provides the recursive capability through the open source BIND9.

[0081] Through the present application, the dependence on KNI is also decoupled.

[0082] Referring to Figure 1 and Figure 2 , a schematic diagram of a datagram processing architecture of the present application is shown.

[0083] The architecture includes the following roles: network card NIC (Network Interface Controller), DPDK, VHost, intranet DNS, TAP, protocol stack and BIND9. The intranet DNS has a master user mode process and a slave user mode process. Each process corresponds to a Vring queue (such as the datagram address queue mentioned later). Each Vring queue corresponds to an IOevent file descriptor. The interaction between these roles can be seen from the arrows in the figure, and will not be described in detail here.

[0084] VIRTIO PMD (Poll Mode Driver) is a driver mode in DPDK for processing VIRTIO. The VIRTIO PMD implements user mode configuration and data processing of virtual or physical network cards through a VFIO interface.

[0085] A VHost adapter is a virtualized SCSI (Small Computer System Interface) adapter that allows virtual machines or guest partitions to connect to storage or other SCSI devices in a virtualized manner. The VHost adapter plays a key role in providing a connection bridge between virtual machines and physical storage.

[0086] Referring to Figure 3 , a step flowchart of a data packet processing method of the application is shown, wherein the method comprises:

[0087] In step S101, for any one of a plurality of user state processes in the DPDK in the user state, after receiving a first data packet sent by a network card in the user state through the user state process, the first data packet is cached in the shared memory through the user state process, and the shared memory is open to access by the user state and the kernel state.

[0088] After the network card in the user state receives the first data packet, the first data packet is forwarded to the DPDK in the user state, and one of the plurality of user state processes in the DPDK receives the first data packet, and the first data packet is cached in the shared memory through the user state process.

[0089] The shared memory can be accessed by the user state and the kernel state.

[0090] The DPDK in the user state can have an intranet DNS, and the intranet DNS has a plurality of user state processes, one of which is a master user state process and the others are slave user state processes.

[0091] There is no lock and no dependency between the user state processes, and the communication between them can use lock-free inter-process communication.

[0092] The master user state process can be responsible for initializing the driver program of the network card and initializing the driver program of the TAP device.

[0093] The network card in the user state has a plurality of network card channels; different network card channels correspond to different data packet address queues.

[0094] Thus, if the user-mode network card sends a datagram through a network card channel, the user-mode process corresponding to the datagram address queue corresponding to the network card channel receives the datagram.

[0095] In step S102, the user-mode process obtains the address of the first datagram in the shared memory.

[0096] The address of the first datagram in the shared memory can be understood as the offset address of the first datagram in the shared memory.

[0097] In step S103, the user-mode process caches the address in the datagram address queue corresponding uniquely to the user-mode process. Different datagram address queues corresponding uniquely to different user-mode processes are different, and each user-mode process corresponds uniquely to a datagram address queue which is open to access by both the user-mode and the kernel-mode.

[0098] The user-mode process can write data in the datagram address queue corresponding uniquely to the user-mode process and read data in the datagram address queue corresponding uniquely to the user-mode process.

[0099] The user-mode process cannot write data in the datagram address queue corresponding uniquely to another user-mode process and cannot read data in the datagram address queue corresponding uniquely to another user-mode process.

[0100] In step S104, the user-mode process obtains the read-write event IOevent file descriptor corresponding uniquely to the datagram address queue. Different datagram address queues correspond uniquely to different IOevent file descriptors.

[0101] In the user-mode, the multiple user-mode processes in the DPDK are independent of each other, one of which is a master user-mode process and the others are slave user-mode processes, and the master user-mode process is responsible for uniquely creating an IOevent file descriptor for each datagram address queue.

[0102] In one embodiment, the user-mode process is one of the master user-mode process and the slave user-mode process in the DPDK in the user-mode, and the IOevent file descriptor corresponding uniquely to the datagram address queue is actively applied for by the slave user-mode process from the master user-mode process through inter-process communication after the slave user-mode process is started.

[0103] Alternatively, in another embodiment of the present application, the user-mode process is the master user-mode process and the slave user-mode process in the DPDK in the user-mode, and the IOevent file descriptor corresponding uniquely to the datagram address queue is assigned by the master user-mode process to itself.

[0104] In step S105, the user-mode process sends the IOevent file descriptor to the kernel-mode VHost.

[0105] In step S106, the kernel-mode VHost receives the IOevent file descriptor.

[0106] In step S107, the kernel-mode VHost extracts the address of the first datagram in the shared memory from the datagram address queue uniquely corresponding to the IOevent file descriptor according to the IOevent file descriptor.

[0107] According to the IOevent file descriptor, the datagram address queue uniquely corresponding to the IOevent file descriptor can be locked, so that the address of the first datagram in the shared memory can be extracted from the datagram address queue uniquely corresponding to the IOevent file descriptor.

[0108] The "extracting" includes reading the address of the first datagram in the shared memory from the datagram address queue uniquely corresponding to the IOevent file descriptor, and then deleting the address of the first datagram in the shared memory from the datagram address queue uniquely corresponding to the IOevent file descriptor to avoid the read address occupying storage space.

[0109] In step S108, the kernel-mode VHost extracts the first datagram in the shared memory according to the address.

[0110] The "extracting" includes reading the first datagram in the shared memory according to the address, and then deleting the first datagram in the shared memory according to the address to avoid the first datagram occupying storage space.

[0111] In step S109, the kernel-mode VHost sends the first datagram to the kernel-mode protocol stack processing.

[0112] After the kernel-mode VHost sends the first datagram to the kernel-mode protocol stack processing through the TAP device, a second datagram can be obtained.

[0113] In one example, the first datagram is dispatched to the BIND9 processing via the kernel-mode protocol stack to obtain the second datagram.

[0114] The process of processing the second datagram can refer to the embodiment shown in the following Figure 2 , and will not be described in detail here.

[0115] In an embodiment of the present application, the VHost in the kernel mode has a plurality of kernel-mode processes, each of which uniquely corresponds to a different user-mode process, that is, the kernel-mode processes and the user-mode processes are in one-to-one correspondence, so that each kernel-mode process also uniquely corresponds to a different IOevent file descriptor.

[0116] In step S107, when the address of the first datagram in the shared memory is extracted from the datagram address queue uniquely corresponding to the IOevent file descriptor by the VHost in the kernel mode according to the IOevent file descriptor, the kernel-mode process uniquely corresponding to the IOevent file descriptor can be determined among the plurality of kernel-mode processes in the VHost in the kernel mode by the VHost in the kernel mode. The IOevent file descriptor is scheduled to the determined kernel-mode process. The address of the first datagram in the shared memory is extracted from the datagram address queue uniquely corresponding to the IOevent file descriptor by the determined kernel-mode process according to the IOevent file descriptor.

[0117] Correspondingly, when the first datagram is extracted from the shared memory according to the address by the VHost in the kernel mode in step S108, the first datagram is extracted from the shared memory according to the address by the determined kernel-mode process.

[0118] Correspondingly, when the first datagram is sent to the protocol stack processing in the kernel mode by the VHost in the kernel mode in step S109, the first datagram is sent to the protocol stack processing in the kernel mode by the determined kernel-mode process.

[0119] The present application constructs a high-performance kernel interaction processing mechanism under a multi-process service based on DPDK, realizes a communication mechanism in a multi-process mode, and has a plurality of datagram address queues in the multi-process mode. Each process communicates with the VHost in the kernel mode through its uniquely corresponding datagram address queue. There is no lock and no competition in resource access between processes. The multi-core forwarding mechanism is fully utilized to process data, improve the forwarding processing capacity of datagrams between the kernel mode and the user mode, and improve the stability of the product and the recursion capability of the intranet DNS product.

[0120] Reference Figure 4 , a step flowchart of a datagram processing method of the present application is shown, wherein the method comprises:

[0121] In step S201, a second datagram obtained after a first datagram is processed by the protocol stack in the kernel mode is acquired by the VHost in the kernel mode.

[0122] After the kernel-mode protocol stack finishes processing the first datagram to obtain the second datagram, the second datagram can be sent to the VHost through the TAP device, and the second datagram sent through the TAP device can be received by the VHost.

[0123] In step S202, the second datagram is cached in the shared memory by the kernel-mode VHost. The shared memory is open to access by both the user mode and the kernel mode.

[0124] In step S203, the address of the second datagram in the shared memory is obtained by the kernel-mode VHost.

[0125] The address of the second datagram in the shared memory can be understood as an offset address of the second datagram in the shared memory.

[0126] In step S204, the user-mode process uniquely corresponding data packet address queue for processing the second datagram is determined in the mutually independent multiple user-mode processes in the DPDK in the user mode by the kernel-mode VHost.

[0127] In an embodiment of the present application, the kernel-mode VHost has multiple kernel-mode processes, each of which uniquely corresponds to a different user-mode process, and each of which uniquely corresponds to a different IOevent file descriptor.

[0128] The second datagram obtained after the kernel-mode protocol stack finishes processing the first datagram. The second datagram is obtained by one of the multiple kernel-mode processes in the kernel-mode VHost. The second datagram is cached in the shared memory by the one kernel-mode process, and the address of the second datagram in the shared memory is obtained by the one kernel-mode process.

[0129] In this way, when the user-mode process uniquely corresponding data packet address queue for processing the second datagram is determined in the mutually independent multiple user-mode processes in the DPDK in the user mode by the kernel-mode VHost, the one kernel-mode process can be used to determine the user-mode process uniquely corresponding data packet address queue uniquely corresponding to the one kernel-mode process in the mutually independent multiple user-mode processes in the DPDK in the user mode.

[0130] For example, the one kernel-mode process can be used to determine the user-mode process uniquely corresponding data packet address queue uniquely corresponding to the one kernel-mode process in the mutually independent multiple user-mode processes in the DPDK in the user mode according to the IOevent file descriptor previously received by the one kernel-mode process. The IOevent file descriptor is sent to the one kernel-mode process by the user-mode process uniquely corresponding to the one kernel-mode process in advance.

[0131] In step S205, the address is cached in a datagram address queue corresponding to the determined user mode process by the VHost in the kernel mode. Different user mode processes correspond to different datagram address queues, and each user mode process corresponds to a unique datagram address queue, which is open to access by the user mode and the kernel mode.

[0132] In step S206, the determined user mode process monitors whether an address is added to the datagram address queue.

[0133] In step S207, in the case where an address is added to the datagram address queue, the determined user mode process extracts the address of the second datagram in the shared memory in the datagram address queue.

[0134] The "extracting" includes reading the address of the second datagram in the shared memory in the datagram address queue, and then deleting the address of the second datagram in the shared memory in the datagram address queue to avoid the read address constantly occupying storage space.

[0135] In step S208, the determined user mode process extracts the second datagram in the shared memory according to the address.

[0136] The "extracting" includes reading the second datagram in the shared memory according to the address, and then deleting the second datagram in the shared memory according to the address to avoid the second datagram constantly occupying storage space.

[0137] In step S209, the determined user mode process sends the second datagram to the network card in the user mode.

[0138] The application constructs a high-performance kernel interaction processing mechanism under a multi-process service based on DPDK, and realizes a communication mechanism in a multi-process mode. In the multi-process mode, there are multiple datagram address queues, each process communicates with the VHost in the kernel mode through its unique corresponding datagram address queue, resource access between processes is lock-free and contention-free, multi-core forwarding mechanism is fully utilized to process data, the forwarding processing capacity of datagrams between the kernel mode and the user mode is improved, and the product stability and the recursion capability of the internal DNS product are improved.

[0139] It should be noted that, for the method embodiments, in order to simply describe, they are all described as a series of action combinations, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other order or at the same time. Secondly, those skilled in the art should know that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present application.

[0140] Reference Figure 5 This application illustrates a datagram processing apparatus, the apparatus comprising:

[0141] The first cache module 11 is used to cache the first datagram in shared memory for any one of the multiple independent user-mode processes in the Data Plane Development Kit (DPDK) in user mode after receiving the first datagram sent by the user-mode network card through the user-mode process. The shared memory has access permissions for both user mode and kernel mode.

[0142] The first acquisition module 12 is used to acquire the address of the first datagram in shared memory through the user-mode process;

[0143] The second cache module 13 is used to cache the address in the datagram address queue uniquely corresponding to the user-mode process through the user-mode process; different user-mode processes have different uniquely corresponding datagram address queues, and each user-mode process has access to the datagram address queue uniquely corresponding to both user mode and kernel mode.

[0144] The second acquisition module 14 is used to acquire the unique IOevent file descriptor corresponding to the datagram address queue through the user-mode process; different datagram address queues have different unique IOevent file descriptors;

[0145] The first sending module 15 is used to send the IOevent file descriptor to the kernel-mode virtual host VHost through the user-mode process;

[0146] Receiving module 16 is used to receive the IOevent file descriptor through the kernel-mode VHost;

[0147] The first extraction module 17 is used to extract the address of the first datagram in shared memory from the datagram address queue uniquely corresponding to the IOevent file descriptor through the kernel-mode VHost based on the IOevent file descriptor;

[0148] The second extraction module 18 is used to extract the first datagram from the shared memory according to the address through the kernel-mode VHost;

[0149] The second sending module 19 is used to send the first datagram to the kernel-mode protocol stack for processing via the kernel-mode VHost.

[0150] The user state process is one master user state process and one slave user state process in the DPDK in the user state, and the IOevent file descriptor uniquely corresponding to the datagram address queue is applied from the master user state process to the slave user state process through inter-process communication after the slave user state process is started.

[0151] The VHost in the kernel state has a plurality of kernel state processes, each of which uniquely corresponds to a different user state process, and each of which uniquely corresponds to a different IOevent file descriptor.

[0152] The first extraction module comprises:

[0153] The first determination unit is configured to determine, through the VHost in the kernel state, a kernel state process uniquely corresponding to the IOevent file descriptor from a plurality of kernel state processes in the VHost in the kernel state.

[0154] The scheduling unit is configured to schedule the IOevent file descriptor to the determined kernel state process.

[0155] The first extraction unit is configured to extract, through the determined kernel state process, an address of a first datagram in the shared memory in the datagram address queue uniquely corresponding to the IOevent file descriptor according to the IOevent file descriptor.

[0156] Correspondingly, the second extraction module comprises:

[0157] The second extraction unit is configured to extract, through the determined kernel state process, the first datagram in the shared memory according to the address.

[0158] Correspondingly, the second sending module comprises:

[0159] The sending unit is configured to send, through the determined kernel state process, the first datagram to the protocol stack processing in the kernel state.

[0160] The application constructs a high-performance kernel interaction processing mechanism under a DPDK-based multi-process service, realizes a communication mechanism in a multi-process mode, and has a plurality of datagram address queues in the multi-process mode. Each process communicates with the VHost in the kernel state through a datagram address queue uniquely corresponding to the process. There is no lock and no competition in resource access between processes. The multi-core forwarding mechanism is fully utilized to process data, the forwarding processing capacity of datagrams between the kernel state and the user state is improved, and the stability of the product and the recursion capability of the intranet DNS product are improved.

[0161] Referring to Figure 6 , a datagram processing device is shown, which comprises:

[0162] The third obtaining module 21 is configured to obtain, by the VHost in the kernel mode, the second datagram processed by the protocol stack in the kernel mode on the first datagram;

[0163] The third caching module 22 is configured to cache, by the VHost in the kernel mode, the second datagram in the shared memory; the shared memory is open to access by the user mode and the kernel mode;

[0164] The fourth obtaining module 23 is configured to obtain, by the VHost in the kernel mode, the address of the second datagram in the shared memory;

[0165] The determining module 24 is configured to determine, by the VHost in the kernel mode, a datagram address queue corresponding uniquely to a user mode process for processing the second datagram in a plurality of user mode processes independent of each other in a data plane development kit (DPDK) in the user mode;

[0166] The fourth caching module 25 is configured to cache, by the VHost in the kernel mode, the address in the datagram address queue corresponding uniquely to the user mode process; the datagram address queues corresponding uniquely to different user mode processes are different, and the datagram address queues corresponding uniquely to each user mode process are open to access by the user mode and the kernel mode;

[0167] The listening module 26 is configured to listen, by the user mode process, to whether the address is added in the datagram address queue;

[0168] The third extracting module 27 is configured to extract, by the user mode process, the address of the second datagram in the shared memory in the datagram address queue in the case that the address is added in the datagram address queue;

[0169] The fourth extracting module 28 is configured to extract, by the user mode process, the second datagram in the shared memory according to the address;

[0170] The third sending module 29 is configured to send, by the user mode process, the second datagram to a network card in the user mode.

[0171] The VHost in the kernel mode has a plurality of kernel mode processes, each kernel mode process corresponds uniquely to a different user mode process, and each kernel mode process corresponds uniquely to a different IOevent file descriptor;

[0172] The second datagram obtained by the protocol stack in the kernel mode after processing the first datagram is acquired by one of the plurality of kernel processes in the VHost in the kernel mode; the second datagram is buffered in the shared memory by the one of the kernel processes, and the address of the second datagram in the shared memory is acquired by the one of the kernel processes;

[0173] The determining module comprises:

[0174] The second determining unit is configured to determine, by the one of the kernel processes, a datagram address queue corresponding to the one of the kernel processes among the plurality of user processes in the DPDK in the user mode.

[0175] The second determining unit comprises:

[0176] The determining sub-unit is configured to determine, by the one of the kernel processes, a datagram address queue corresponding to the one of the kernel processes among the plurality of user processes in the DPDK in the user mode according to an IOevent file descriptor previously received by the one of the kernel processes; the IOevent file descriptor is sent by the user process corresponding to the one of the kernel processes to the one of the kernel processes in advance.

[0177] The present application constructs a high-performance kernel interaction processing mechanism under a multi-process service based on DPDK, and realizes a communication mechanism in a multi-process mode. In the multi-process mode, there are multiple datagram address queues, each process communicates with the VHost in the kernel mode through its uniquely corresponding datagram address queue, resource access between processes is lock-free and contention-free, data is processed by fully utilizing a multi-core forwarding mechanism, the forwarding processing capability of datagrams between the kernel mode and the user mode is improved, and the stability of the product and the recursion capability of the intranet DNS product are improved.

[0178] Optionally, the embodiment of the present application further provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program is executed by the processor to implement each process of the above-mentioned method embodiment and achieve the same technical effects. To avoid repetition, details are not repeated here.

[0179] The embodiment of the present application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to realize each process of the method embodiment and achieve the same technical effects. To avoid repetition, details are not described herein. The computer readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0180] Figure 7 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0181] Referring to Figure 7 , the electronic device 800 can include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.

[0182] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with displaying, making phone calls, data communications, camera operations, and recording operations. The processing component 802 can include one or more processors 820 to execute instructions to complete all or part of the steps of the above methods. In addition, the processing component 802 can include one or more modules to facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0183] The memory 804 is configured to store various types of data to support the operation of the device 800. Examples of these data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, images, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0184] The power component 806 provides power to the various components of the electronic device 800. The power component 806 can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 800.

[0185] The multimedia component 808 includes a screen providing an output interface between the electronic device 800 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes the touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide, and a gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or a sliding action, but also detect duration and pressure related to the touching or sliding action. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0186] The audio component 810 is configured to output and / or input an audio signal. For example, the audio component 810 includes a microphone (MIC) configured to receive an external audio signal when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 further includes a speaker for outputting an audio signal.

[0187] The I / O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which can be a keypad, a click wheel, buttons, and the like. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0188] The sensor component 814 includes one or more sensors for providing status assessments for various aspects of the electronic device 800. For example, the sensor component 814 can monitor the opening / closing status of the device 800, relative positioning of components, such as a display and a keypad of the electronic device 800, changes in position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration / g-force and temperature changes of the electronic device 800. The sensor component 814 can include an optical sensor that is configured to monitor ambient light levels and output a signal indicative of the ambient light level. The sensor component 814 can also include a proximity sensor configured to monitor the presence of nearby objects without any physical contact. The sensor component 814 can further include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 814 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0189] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a cellular network (e.g., 2G, 3G, 4G or 5G), or a combination thereof. In an example embodiment, the communication component 816 receives broadcast signals or broadcast operation information from an external broadcast management system via a broadcast channel. In an example embodiment, the communication component 816 can further include a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) techniques, infrared data association (IrDA) techniques, ultra-wideband (UWB) techniques, Bluetooth (BT) techniques, and other techniques.

[0190] In an example embodiment, the electronic device 800 can be implemented using one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic elements for performing the above-described methods.

[0191] In an example embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 804 including instructions, is also provided, which can be executed by the processor 820 of the electronic device 800 to complete the above-described methods. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.

[0192] Figure 8is a block diagram of an electronic device 1900 shown in the present application. For example, the electronic device 1900 can be provided as a server.

[0193] Referring to Figure 8 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932, for storing instructions, such as an application program, executable by the processing component 1922. The application program stored in the memory 1932 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute the instructions to perform the above-mentioned method.

[0194] The electronic device 1900 can also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 can operate based on an operating system stored in the memory 1932, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.

[0195] It should be noted that in this paper, the term "include", "contain" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.

[0196] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, air conditioner or network device, etc.) execute the method described in each embodiment of the present application.

[0197] The embodiments of the present application are described above with reference to the accompanying drawings, but the present application is not limited to the specific embodiments described above, and the specific embodiments described above are merely illustrative, but not restrictive, and a person of ordinary skill in the art can make many forms under the inspiration of the present application without departing from the purpose of the present application and the scope protected by the claims, and all of them belong to the protection of the present application.

[0198] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software mode depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0199] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

[0200] In the embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented by other ways. For example, the device embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0201] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected to achieve the purpose of the embodiment of the present application according to actual needs.

[0202] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0203] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments 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 ROM, a RAM, a magnetic disk or an optical disk, etc.

[0204] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A data packet processing method, characterized in that, The method includes: For any one of the multiple independent user-mode processes in the Data Plane Development Kit (DPDK) in user mode, after receiving the first datagram sent by the user-mode network card through the user-mode process, the user-mode process buffers the first datagram in shared memory, and the shared memory has access permissions for both user mode and kernel mode. The user-mode process obtains the address of the first datagram in shared memory. The address is cached by the user-mode process in the datagram address queue uniquely corresponding to the user-mode process; different user-mode processes have different unique datagram address queues, and each user-mode process has access to its unique datagram address queue that is open to both user mode and kernel mode. The user-space process obtains the unique IOevent file descriptor corresponding to the datagram address queue; different datagram address queues have different unique IOevent file descriptors. The user-mode process sends the IOevent file descriptor to the kernel-mode virtual host VHost. The IOevent file descriptor is received by the VHost in kernel mode; The kernel-mode VHost extracts the address of the first datagram in shared memory from the datagram address queue uniquely corresponding to the IOevent file descriptor based on the IOevent file descriptor. The kernel-mode VHost retrieves the first datagram from the shared memory based on the address; The first datagram is sent to the kernel-mode protocol stack for processing via the kernel-mode VHost.

2. The method according to claim 1, characterized in that, The user-mode process is: one master user-mode process in DPDK in user mode and one slave user-mode process among multiple slave user-mode processes. The IOevent file descriptor uniquely corresponding to the datagram address queue is actively requested from the master user-mode process through inter-process communication after the slave user-mode process starts.

3. The method according to claim 1, characterized in that, The kernel-mode VHost contains multiple kernel-mode processes, each kernel-mode process uniquely corresponds to a different user-mode process, and each kernel-mode process uniquely corresponds to a different IOevent file descriptor. The step of retrieving the address of the first datagram in shared memory from the datagram address queue uniquely corresponding to the IOevent file descriptor via the kernel-mode VHost includes: By using the VHost in the kernel mode, the kernel mode process that uniquely corresponds to the IOevent file descriptor is determined among multiple kernel mode processes in the VHost in the kernel mode. Schedule the IOevent file descriptor to a specific kernel-mode process; The kernel-mode process, based on the IOevent file descriptor, extracts the address of the first datagram in shared memory from the datagram address queue uniquely corresponding to the IOevent file descriptor. Accordingly, the step of retrieving the first datagram from shared memory based on the address via the kernel-mode VHost includes: The first datagram is extracted from the shared memory by a determined kernel-mode process based on the address; Accordingly, the step of sending the first datagram to the kernel-mode protocol stack for processing via the kernel-mode VHost includes: The first datagram is sent to the kernel-mode protocol stack for processing by a designated kernel-mode process.

4. A data packet processing method, characterized in that, The method includes: The second datagram is obtained by processing the first datagram using the kernel-mode virtual host VHost; The second datagram is cached in shared memory via a kernel-mode VHost; the shared memory has access permissions for both user mode and kernel mode. Obtain the address of the second datagram in shared memory through the kernel-mode VHost; By using the kernel-mode VHost, the unique datagram address queue corresponding to the user-mode process used to process the second datagram is determined among multiple independent user-mode processes in the Data Plane Development Kit (DPDK) in user mode. The address is cached in the datagram address queue unique to a specific user-mode process through the kernel-mode VHost; different user-mode processes have different unique datagram address queues, and each user-mode process has access to its unique datagram address queue that is open to both user mode and kernel mode. A defined user-mode process monitors whether an address has been added to the datagram address queue. When an address is added to the datagram address queue, the address of the second datagram in shared memory is extracted from the datagram address queue by a determined user-space process. The user-mode process retrieves the second datagram from the shared memory based on the address; The second datagram is sent to the user-mode network card by a defined user-mode process.

5. The method according to claim 4, characterized in that, The kernel-mode VHost contains multiple kernel-mode processes, each kernel-mode process uniquely corresponds to a different user-mode process, and each kernel-mode process uniquely corresponds to a different IOevent file descriptor. The second datagram, obtained after the kernel-mode protocol stack processes the first datagram, is obtained by one of the multiple kernel-mode processes in the kernel-mode VHost; the second datagram is cached in shared memory by the aforementioned kernel-mode process, and the address of the second datagram in shared memory is obtained by the aforementioned kernel-mode process. The process of determining the unique datagram address queue corresponding to the user-space process handling the second datagram among multiple independent user-space processes in the DPDK within the kernel-space VHost includes: Through the aforementioned kernel-mode process, among multiple independent user-mode processes in the DPDK in user mode, a datagram address queue uniquely corresponding to the user-mode process that is uniquely associated with the aforementioned kernel-mode process is determined.

6. The method according to claim 5, characterized in that, The step of determining, through the single kernel-mode process and among multiple independent user-mode processes in the DPDK within user mode, a unique datagram address queue corresponding to the single kernel-mode process includes: Based on the IOevent file descriptor received in advance by the kernel-mode process, a datagram address queue uniquely corresponding to the kernel-mode process is determined among multiple independent user-mode processes in the DPDK in user mode; the IOevent file descriptor is sent in advance by the user-mode process uniquely corresponding to the kernel-mode process to the kernel-mode process.

7. A data packet processing apparatus, characterized in that, The device includes: The first caching module is used to cache the first datagram in shared memory for any one of the multiple independent user-mode processes in the Data Plane Development Kit (DPDK) in user mode after receiving the first datagram sent by the user-mode network card through the user-mode process. The shared memory has access permissions for both user mode and kernel mode. The first acquisition module is used to acquire the address of the first datagram in shared memory through the user-mode process; The second caching module is used to cache the address in the datagram address queue uniquely corresponding to the user-mode process through the user-mode process; different user-mode processes have different uniquely corresponding datagram address queues, and each user-mode process has access to the datagram address queue uniquely corresponding to both user mode and kernel mode. The second acquisition module is used to acquire the unique IOevent file descriptor corresponding to the datagram address queue through the user-space process; different datagram address queues have different unique IOevent file descriptors; The first sending module is used to send the IOevent file descriptor to the kernel-mode virtual host VHost through the user-mode process; The receiving module is used to receive the IOevent file descriptor through the kernel-mode VHost; The first extraction module is used to extract the address of the first datagram in shared memory from the datagram address queue uniquely corresponding to the IOevent file descriptor through the kernel-mode VHost; The second extraction module is used to extract the first datagram from the shared memory based on the address via the kernel-mode VHost. The second sending module is used to send the first datagram to the kernel-mode protocol stack for processing via the kernel-mode VHost.

8. A data packet processing apparatus, characterized in that, The device includes: The third acquisition module is used to acquire the second datagram obtained by the kernel-mode protocol stack after processing the first datagram through the kernel-mode virtual host VHost; The third cache module is used to cache the second datagram in shared memory through the kernel-mode VHost; the shared memory has access permissions for both user mode and kernel mode; The fourth acquisition module is used to obtain the address of the second datagram in shared memory through the kernel-mode VHost; The determination module is used to determine the unique datagram address queue corresponding to the user-space process that handles the second datagram among multiple independent user-space processes in the Data Plane Development Kit (DPDK) in user space, through the kernel-space VHost. The fourth caching module is used to cache the address in the datagram address queue uniquely corresponding to a specific user-mode process through the kernel-mode VHost; different user-mode processes have different unique datagram address queues, and each user-mode process has access to its unique datagram address queue that is open to both user-mode and kernel-mode. The monitoring module is used to monitor whether an address has been added to the datagram address queue through a defined user-space process; The third extraction module is used to extract the address of the second datagram in shared memory from the datagram address queue by a determined user-mode process when an address has been added to the datagram address queue. The fourth extraction module is used to extract the second datagram from the shared memory based on the address by a determined user-mode process; The third sending module is used to send the second datagram to the user-space network card through a determined user-space process.

9. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the datagram processing method as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the datagram processing method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data receiving method and device, data sending method and device, electronic equipment and medium

    CN115269213A

  • At least one user space resident interface between at least one user space resident virtual appliance and at least one virtual data plane

    US20150370582A1